Car Door Opening Animation

Hey guys,
So I wanted to make a car door opening animation for Anthros & R15, but I’ve run into a problem and I’m hoping someone can help me find a solution.

So right now I planned to have two attachments, one on the player’s hand, and one on the car door. The player animation would reach out to the door, placing the hand attachment in the same place as the door grip attachment, then the animation would fire an event creating a BallSocketConstraint between the player hand and the car door. Once the player pulls the door out of the way, the constraint would be removed and the player climbs into the car.

Basically think GTA.

Here’s a gif I have so far of the animation:

I have 2 problems I’m not sure how to handle:

  • Humanoid:MoveTo does not make the player face a direction
  • There is no way to use Inverse Kinematics in realtime to make the hand attachment and the door attachment align.

Is there a way I can get around this and possibly have the player bend over to reach the handle, or something of the sort?

I don’t think there are many ways to handle this with the current API, but maybe someone here knows.

As a side note, I think I’d like to stay away from insane math at the moment haha. I’m mostly curious to see what kinds of tools roblox has to offer for such a goal.

Thanks!

5 Likes

For your first issue, you can try cframe.new(pos, lookat) (lookat and pos are vector3 values)

As for the second:

  1. you could try creating a temporary motor6d between the hand and the door with the attachments
  2. Or you can try to create a keyframe event that when reached plays a separate animation for the door

Use humanoid:Move() [don’t use MoveTo()] on client side/local script, tween the rotation of humanoidrootpart to face the required direction to correct for discrepancy at the end of the movement, then play the animation - this will ensure a smooth and consistent experience.

EDIT: Meant to reply to OP - not GreekForge’s post

I wasn’t going to use a Motor6D because that would require me to manually animate each door on each car. Instead I wanted the animation to find the door handle attachment, then bend the player over forwards enough so that the two attachments line up perfectly. From there a BallSocketConstraint would be added on the Handle and the person’s hand so that the door follows the motion of the hand through the game’s physics; no extra animation work (works better since large trucks and things may need the player to be reaching up more). Is there a way I could calculate how much the player needs to bend over to reach the door, then use a Script to set the C0 of the waist joint accordingly? It’s hacky and I don’t think I’d be capable of making that happen, but theoretically possible right?

3 Likes

There is. but you would need to use some complicated maths.
You would need to calculate the angle you need to bend over along with having to move the arm which is under the influence of a static animation (one that cant be edited during the animation) so that method would be convoluted at best.

You could try lerping the motor6d’s however that would require some knowledge in it and some guess and check. (If you don’t know what lerping is, its basically moving the motor’s C0 with the lerp function, this was how they animated things back when scripters didn’t have the aid of animators)

2 Likes