Hi all, tanx for any help you can provide…
i use this code to roll a sphere in the direction the camera is facing…
var cameraTransform = Camera.main.transform;
// Forward vector relative to the camera along the x-z plane
var forward = cameraTransform.TransformDirection(Vector3.forward);
forward.y = 0;
forward = forward.normalized;
// Right vector relative to the camera
// Always orthogonal to the forward vector
var right = Vector3(forward.z, 0, -forward.x);
if(Input.GetKey(KeyCode.W))
rigidbody.AddTorque (right * speed);
if(Input.GetKey(KeyCode.S))
rigidbody.AddTorque (right * -speed);
if(Input.GetKey(KeyCode.Space) canJump)
rigidbody.AddForce (Vector3.up * speed * jumpForce);
if(Input.GetKey(KeyCode.D))
rigidbody.AddTorque (forward * -speed);
if(Input.GetKey(KeyCode.A))
rigidbody.AddTorque (forward * speed);
I use this code to show the speed in m/s :
Debug.Log("Speed: " + rigidbody.velocity.magnitude.ToString() + "m/s");
The problem is that my speed is capped at 17 m/s even if i put 100000 as a speed…is it normal ?
tanx all for your answers