Rotate object with mouse
Hey!
I am trying to rotate a triangular shaped planet with a mouse drag,
It should rotate around its axis (horizontally and vertically).
But i can't get it to work.
public float horizontalSpeed = 2.0F; public float verticalSpeed = 2.0F;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseDrag()
{
float h = horizontalSpeed * Input.GetAxis("Mouse X");
float v = verticalSpeed * Input.GetAxis("Mouse Y");
transform.Rotate(v, h, 0);
}
}
This also makes it rotate around Z somehow...
(i am basically trying to get it like they did here: https://kenney.itch.io/techium-eclipse)
Does someone maybe know a way to do this?
Your answer
Follow this Question
Related Questions
How to rotate an object around a player when pushing a button..? 0 Answers
How do I rotate an object around around another, following mouse position and facing it? 0 Answers
Rotate Ball specific number of degrees and back again 0 Answers
How to Transform.Rotate Around with the rotation of the controller right stick 0 Answers
How to find current vertical axis 1 Answer