topaz7
January 20, 2013, 8:03am
1
When both Horizontal and Vertical input is being pressed, the rigidbody moves twice as fast if only 1 being pressed.
rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * accel * Time.deltaTime, 0, Input.GetAxis("Vertical") * accel * Time.deltaTime);
Amon
January 20, 2013, 8:21am
2
What value does accel have? It may be worth rewriting it as it appears when both are pressed, whatever value accel has, it moves twice as fast because accel is being applied twice.
Try also to += accel instead of * accel!
Timer
January 20, 2013, 12:18pm
3
Vector3 temp = new Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical")).normalized*accel*Time.deltaTime;
rigidbody.AddRelativeForce(temp);
this way only direction with change and magnitude will be same.
topaz7
January 20, 2013, 5:54pm
4
Thanks Amon and Timer. It worked.