Search Instagram Twitter Facebook Spotify Grid Tag Date Folder Chat Pencil

Separating Position and Rotation Curves

Quote from: Juan Raigada on February 26, 2015, 07:29:18 AM

Question: are you using the curve both for rotation and movement, or are you just stopping the movement while rotating? (I’m trying to make sense of the stop and go effect you mention).

 

Juan’s comment in response to my last update made me realize that rotation and position are indeed separate. I have been working on this for so long that the action of switching to a wall just seemed like one action.

This is what the code looks like:

1
2
3
4
float y = rotationCurve.Evaluate(t);

transform.position = Vector3.Lerp(orgPos, dstPos, y);
transform.rotation = Quaternion.Lerp(orgRot, dstRot, y);

As you see, both the position and rotation changes are reading from the same animation curve.

I decided to try decoupling that and having separate animation curves for each.

Here’s the comparison test video:

Again, it’s very difficult for me to tell, because of how close I am to the project, but I think separate animation curves do help a little.

I made the position curve end slightly earlier than than the rotation curve. The thinking here is that the player is already moving by the time the rotation finishes.

Anyway, I’ll need to start playtesting to really figure it out.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.