Hi everyone,
I have robots that shoot lasers. Currently, they shoot at the character.
Laser.SetPosition(0, Cero.position);
Laser.SetPosition(1, Victim.position);
(BTW, Cero is the point out of which they’re shooting.)But I want them to shoot forward on their Z axis. So I did:
Laser.SetPosition(0, Cero.position);
Laser.SetPosition(1, Vector3.fwd);
But instead of shooting on their z axis, they’re shooting off to some random spot:
And in the picture, it’s hard to see, but that robot is shooting to his right.
What’s the issue, and is there a way to make them simply shoot a linerenderer forward?
I think you want Cero.forward (forward relative to Cero) rather than Vector3.forward (forward relative to zero). :)
– Loius@Louis, You may be right, but he says in the question "forward on their Z axis," so I coded it this way. @Hyperion, if you mean forward of the character, then: Laser.SetPosition(1, Cero.position + Cero.forward * distance);
– robertbuThanks for your guys' help. Now I'm using Laser.SetPosition(0, Cero.position); Laser.SetPosition(1, Cero.position + Cero.forward * Lazdist); And the lazer goes in the right direction. But now, the lazer isn't long enough, even if I change distance to 1000. What's the issue? ![alt text][1] [1]: /storage/temp/9326-issue2.png
– HyperionIf this is answered, please accept the right answer, by selecting the tick under the thumbs down button :)
– Benproductions1@Benproductions1: It hasn't been fully answered, but I of course will accept the answer when my second question has been answered (up above)
– Hyperion