- Home /
Question by
ZdzichuRonczka · Oct 21, 2020 at 03:34 PM ·
rotationmovementmobilecontrols
2.5D Mobile joystick rotation problem
Hey, i've got an issue when im doing mobile joystick for my next game and don't know how to fix it.
The normal mouse control for me is working - just turning around with mouse and moving forward with mouse click - easy.
The mobile have problem with turning - its just crasy turn all the time while using this mobile joystick, just like this.
https://www.youtube.com/watch?v=E46EQShvtlQ
Heres some code ive working.
void JoystickMove(float h, float v)
{
Vector3 move = transform.right * h + transform.forward * v;
PlayerCC.Move(move * speed * Time.deltaTime);
velocity.y += gravity * Time.deltaTime;
PlayerCC.Move(-velocity * Time.deltaTime);
transform.LookAt(transform.position + move);
}
Anyone know how to fix it? Without turning script, the moving is working, but i want both of them :/ . Another thing is that i don't want to use rigidbody or any physics on this simple game, but i don't think its important now :/ .
Comment