Now that i’ve seen the update , you can just create an array where you store the rotations and just use them on the spot.
Note : if the reason why you don’t want to create the Quaternions everytime is for “performance” then my advice is to not worry about it and and create your quaternions every time
you can do something like this
private Quaternion GetRotationFromAngle(float angle)
{
return Quaternion.AngleAxis(angle , Vector3.up);
}
// example of use
{
Quaternion rot = GetRotationFromAngle(180);
UnityEngine.Object.Instantiate<GameObject>(
this.projectile ,
from.position,
rot
);
}
another thing is that is there any way to make it so i wont have to create tons of quanternions for other angles?
This should work is 3D as well (well for 90% of the cases). As for the creating thing , you can just "pre-create" the quaterions and cache them somewhere. Maybe i missed what you really was so maybe post more context/examples
This should work is 3D as well (well for 90% of the cases). As for the creating thing , you can just "pre-create" the quaterions and cache them somewhere. Maybe i missed what you really was so maybe post more context/examples
– PixelEyesDev