Question by
savanluffy · Aug 07, 2017 at 05:56 PM ·
rotationrotate objectmovingrotatearoundmovinggameobject
Gameobject wont move after rotating it
void Update()
{
// move
_rigidbody.MovePosition(transform.position + (transform.forward * leftController.GetTouchPosition.y * Time.deltaTime * speedMovements) +
(transform.right * leftController.GetTouchPosition.x * Time.deltaTime * speedMovements) );
//spinning
double rad = Mathf.Atan2(leftController.GetTouchPosition.y, leftController.GetTouchPosition.x);
double deg = rad * (180 / System.Math.PI);
transform.RotateAround(transform.position, Vector3.up, (float) deg);
}
So when I move my joystick my gameobject just spins all the time till i stop moving the gameobject. Without the spinning code I can move my gameobject smooth without problems. But after I rotate it I cant move. I just spin the entire time.
Comment