Question by
jess_trice · Mar 05, 2016 at 12:43 AM ·
rotationsmoothingexternal controller
smooth rotation with external command
Hi, i want manage a vassel but with an aexternal commant wich send some numbers, for example : 4 --> ToTheRight , 5 --> ToTheLeft etc... so, i use this code : Vector3 movement = new Vector3(-1.0f, 0.0f, 1.0f);
_rigidbody.velocity = movement * _speed;
_rigidbody.rotation = Quaternion.Euler(0.0f, 0.0f, _rigidbody.velocity.x * -tilt);
but the movement is too rough,
Have you got an idea for a smooth rotation, i want a same movement that i have with this code : float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, moveVertical, 1.0f);
_rigidbody.velocity = movement * _speed;
//rotation du vaisseau
_angleHorizontal = _speed * moveHorizontal;
_angleVertical = _speed * -moveVertical;
_rigidbody.rotation = Quaternion.Euler( _angleVertical, _angleHorizontal, _rigidbody.velocity.x * - tilt);
but this time i don't use keyboard.
Thanks for your answers, and sorry for my english...
Comment
Your answer
