Hi,
I’m instantiating a cylinder prefab to act as a laser-type projectile, however it is instantiated vertically. How do I code it to flip forward (in the direction its facing?
Thanks!
Hi,
I’m instantiating a cylinder prefab to act as a laser-type projectile, however it is instantiated vertically. How do I code it to flip forward (in the direction its facing?
Thanks!
When you instantiate an object, you can optionally specify a position and orientation for the object. To flip it forward, simply provide an appropriate orientation.
Additionally, if the cylinder isn’t oriented the way you want in local space, you can make the cylinder a child object of the actual projectile object, and then orient the child object so that it’s pointing in the desired direction. (For example, if Unity’s built-in cylinder objects are y-aligned and you want the cylinder to be z-aligned, you would apply a 90-degree rotation about the x axis.)