Hello everybody, i’ve been trying to do this but I just can’t handle it, somehow I just can’t figure out how to implement a Lerp function into this, might be because I have absolutely no idea how Quaternion work ( seriously how do you learn that, XYZ are so much more different.
Anyway, here’s what I’m trying to do, I have this script
var RotSpeed : float;
var LastRot : Quaternion;
var OrigRot : Quaternion;
function OnMouseDown()
{
OrigRot = transform.rotation;
}
function OnMouseUp()
{
LastRot = transform.rotation;
}
function OnMouseDrag()
{
transform.Rotate(Vector3(0, Input.GetAxis("Mouse X") * RotSpeed * Time.deltaTime, 0));
}
Which Works totally fine, the thing rotates wherever I want on the Horizontal Axis, but I have no idea how to implement a Lerp function inside this.
I’ve tried with
var RotSpeed : float;
var LerpRot : float;
var LastRot : Quaternion;
var OrigRot : Quaternion;
var TargetRot : Quaternion;
var DistRot : Quaternion;
function OnMouseUp()
{
LastRot = transform.rotation;
transform.rotation = Quaternion.Lerp(LastRot, TargetRot, LerpRot * Time.deltaTime)
}
But it just doesn’t work, the Plane just doesn’t lerp at all, it just locks in position.
Does someone have a better idea on how these things work? because I’m at my block point and cannot for the life of me do this