- Home /
How can I rotate a gameobject with mouse drag?
How can I rotate a gameobject with mouse drag? (I want to rotation along Y axis only )
I have search many example like this:
http://answers.unity3d.com/questions/177391/drag-to-rotate-gameobject.html
but they only work when drag bellow of the gameobject like this. if I drag top of the gameobject that will cause wrong rotate direction How can I fix / achieve it?
Answer by panoramabeats · Jul 11, 2017 at 07:43 AM
if I drag top of the gameobject that will cause wrong rotate direction How can I fix / achieve it?
Possible answer for this part: If you're using a script that includes something like
transform.Rotate (Vector3.back, ( Speed * Time.deltaTime))
you would use Vector3.forward instead of back. It may be Vector2 or Vector4 for your purposes.
"Speed" is public float value in this case.
Your answer
![](https://koobas.hobune.stream/wayback/20220612125959im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
Multiple Cars not working 1 Answer
help me to rotate an object 1 Answer
How to rotate about 360 on a coroutine 3 Answers
issue after 360 degrees rotation 1 Answer