I understand this isnt much of a general Unity question and would be more of a question to ask Alex, but I thought maybe anyone here could possibly answer faster. Alex hasnt answered his forum in over a week…
I have LookRotation() for my pathfinding object which works nicely until i set the nodes at an angle to one another. I set up 6 path nodes in a large arc. when the object reaches each node, its facing direction quickly snaps upward and then continues to the next node. Its very quick, but the object looks like its jerking on each node. Is there a better way of facing the object forward in its moving direction and keep it from jerking upward at each node?..just make it look more fluid through its path.
var target : Transform;
function Update () {
var relativePos = target.position - transform.position;
var rotation = Quaternion.LookRotation(relativePos);
transform.rotation = rotation;
transform.eulerAngles = Vector3(transform.eulerAngles.x, GameObject.Find("some node").GetComponent(Transform).rotation.y, transform.eulerAngles.z);
}
Something like this would work. Which hopefully gets the same position from the LookRotation, but instead restricts the rotation to be the same as the node. Not sure this will work at all, but the idea is there. What you want is to get the appropriate angle you want and set it to your camera so that it doesn’t jerk. Another alternative could be to quickly use LookRotation on the next node quickly so it never gets to the point of jerking up.
Put it in answers, because the comment format for code is horrid.