Hi ! First of all, I’d just like to clarify that I am quite new to Unity and not a programmer but a sound guy.
So here’s the thing, I am currently working on a game where the main character is a robot that floats above the ground thanks to thrusters. When you move left or right, the pitch of his thrusters goes up according to speed (thanks to a script I borrowed from a friend). But the thing is, the pitch goes up too fast and I think SmoothDamp would be a good way to create some inertia to that pitchup/pitchdown action, right ?
Here’s the script
var target : Transform;
var smoothTime = 0.3;
private var yVelocity = 0.0;
function Update () {
var newPosition : float = Mathf.SmoothDamp(transform.position.y, target.position.y,
yVelocity, smoothTime);
transform.position = Vector3(transform.position.x, newPosition, transform.position.z);
}
Would someone be kind enough to explain what variables should be changed ? I don’t know much about programming but I’m guessing the target is not Transform (since this is about position) but I don’t know what to replace it with.
Any help would be much appreciated.