- Home /
Question by
wegaz · Aug 19, 2014 at 03:24 PM ·
javascriptmovementphysicsrigidbody
Weird Movement
Hello, I made a movement script. It is simple but it moves really weird like there is friction. How can i prevent that and yes I tried adding time.deltatime.
#pragma strict
var speed : float = 0.05;
function Update ()
{
if (Input.GetKey("w"))
{
transform.position.z += speed;
}
if (Input.GetKey("s"))
{
transform.position.z -= speed;
}
}
Comment
Answer by smoggach · Aug 19, 2014 at 03:51 PM
Try using FixedUpdate instead. Update is called at irregular intervals which is causing your movement to look irregular. Also i'd suggest lerping towards a target.
Your answer
Follow this Question
Related Questions
How not to make a RigidBody not go into ground when tilted foward? 1 Answer
AddForce not working 0 Answers
How to handle walls with my FirstPersonCharacter? 1 Answer
Click to move a character in a terrain 1 Answer
Unity3D Ai wont shoot 1 Answer