- Home /
Question by
MGUELfig189 · Sep 03, 2021 at 06:52 AM ·
instantiatequaterniontransform.rotation
How to rotate the instantiated object automatically?
I have an object and I have already instantiated it but I want it to roll according to the situation with degrees from 0 to 90 and automatically please I have not left there and I have investigated and nothing. I already tried Quaternio.Euler (0,90,0) and I will just instantiate with just that rotation and that's not what I want :(
captura-de-pantalla-758.png
(13.9 kB)
Comment
Best Answer
Answer by Riiich · Sep 03, 2021 at 08:41 AM
Try this:
GameObject obj = Instantiate(well, spawnSpot, Quaternion.identity);
Then
obj.rotation = Quaternion.Euler(0, 90, 0);
or if you need local rotation
obj.localRotation = Quaternion.Euler(0, 90, 0);
i recommend looking into Quaternion.Slerp, if you want a smooth turn
Your answer
Follow this Question
Related Questions
UnityEngine.Object.Instantiate 1 Answer
Unity Rotations not working properly? Help.... 0 Answers
Bullet always facing the sky. 3 Answers
How to make a gameobject have a rotation constraint? 1 Answer
problem spawning bullets in c# 2 Answers