- Home /
Answer by Novodantis 1 · Jun 29, 2010 at 08:19 AM
Dampening is typically achieved by an intermediate value; recording in effect where you're trying to go, then place the actual value between current and desired position using Linear Interpolation (Lerp).
Try replacing the contents of Update() with:
var yAxis = Input.GetAxis("Mouse Y");
yAxis = Mathf.Lerp(yAxis, transform.position.y, Time.deltaTime);
transform.Translate(0, yAxis, 0, Space.Self);
thanx for your answer. i can see the cube is moving smooth. but its not damping..its speedup?!
I don't quite understand what your aim is here, I think this is the problem. $$anonymous$$ouseY axis is vertical change in mouse poisiton, which is currently controlling acceleration. Is that what you indended?
Answer by twinnightmare · Jun 29, 2010 at 10:41 PM
try this
object.Translate (0, Input.GetAxis("Mouse Y") * Time.deltaTime, 0, Space.Self);
Answer by 3dDude · Jul 28, 2010 at 03:32 PM
try this:
var yAxis = Input.GetAxis("Mouse Y");
yAxis = Mathf.Lerp(yAxis, transform.position.y, Time.deltaTime*5);
transform.Translate(0, yAxis, 0, Space.Self);
Answer by rzn · Jun 30, 2010 at 01:07 PM
thanx, but this is not working. Novodantis' answer seems to be the correct step, but there is an issue - the object speeds up unlimited - its not damping the move!
try this ins$$anonymous$$d:
private var yLerp : float;
var yAxis = Input.GetAxis("$$anonymous$$ouse Y");
yLerp = $$anonymous$$athf.Lerp(yAxis, transform.position.y, Time.deltaTime*5);
transform.Translate(0, yLerp, 0, Space.Self);
Your answer

Follow this Question
Related Questions
Problem of creating smooth animations 3 Answers
smooth motion 1 Answer
Smooth Flashlight Movement 1 Answer
Can anyone translate this to C# (Change cursor appearance) 1 Answer