Answer the question
In order to leave comments, you need to log in
How to rotate the sphere with a joystick:?
There is a 3D sphere in the 2D game and there is a joystick, you need the sphere to rotate with the joystick.
The player turns the joystick and the joystick turns the sphere. Someone knows how to do this, otherwise I'm not boom boom?
Answer the question
In order to leave comments, you need to log in
you take a joystick from the asset shop, it will give you x and y values from -1 to 1.
then you take and rotate the ball through x and z.
sample code:
Vector2 input = joystick.input;
Transform sphere = sphereObject;
float rotateSpeed = 10;
var euler = sphere.eulerAngles;
euler.x += input.x * rotateSpeed;
euler.z += input.y * rotateSpeed;
sphere.eulerAngles = euler;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question