Answer the question
In order to leave comments, you need to log in
How to hold a beautiful beam?
Previously, I already asked how to make a laser beam, rummaged through various examples, I couldn’t really figure it out.
Here's what I have at the moment - there is a gun that has a tower (initial coordinate), there is an enemy (end coordinate), I have these two coordinates calculated normally, and that I build a beam like this
void Start(){
towerHead = transform.Find("Head");
GameObject lineObj = new GameObject("LineObj");
lineRenderer = lineObj.AddComponent<LineRenderer>();
}
void Update(){
lineRenderer.SetPosition(0,towerHead.transform.position);
lineRenderer.SetPosition(1,enemy.transform.position);
.............
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question