When i instantiate my tombstone, it is in my enemies rotation, so it lays flat. How do i set the rotaion (x,y,z) in the code? i looked in the docs but couldn’t find it.
Instantiate(Tomb, transform.position, transform.rotation);
When i instantiate my tombstone, it is in my enemies rotation, so it lays flat. How do i set the rotaion (x,y,z) in the code? i looked in the docs but couldn’t find it.
Instantiate(Tomb, transform.position, transform.rotation);
transform.rotation is a quaternion variable, which isn’t measured in x,y,z like you see in the inspector. You’re looking for euler angles. If you use Quaternion.Euler(x,y,z) it’ll return a quaternion equivalent.
script reference here
for no rotation what so ever:
Instantiate(object, whateverTransform.position, Quaternion.identity);
what you’re probably doing is
Instantiate(object, someTransform.position, someEffedUpRotationalTransformThatYouDontWant.rotation);
Ok, i did that but the rotation didnt change… here’s my var
var rotations = Quaternion.Euler(90, 90, 90);
and my instantaiting…
Instantiate(Tomb, transform.position, rotations);
Lol, yeah i’ll try that. The above post was for eteeski
Yeah that didn’t work either because the rotation of the tomb is strait down, not an angle, and i still cant get Euler to work. Anyone?
Bump.
If you want it straight up, what’s wrong with Quaternion.identity?
I didn’t. i thought by no rotation, he ment it would be in the rotation you set it as in the prefab. I want it to be at a slight angle, like tombstone that have been there a while. Right now it’s just laying strait flat on the ground.