Download

BasketBall game : how to make a player grab the rim?

Hello,

I’m currently developing a basket ball game in UE4 (like NBA Jam), and I don’t find an obvious way to make my players grab the rim with their hands when they dunk the ball.

I control the trajectory of the players when they are in the air, so I can make them be where I want when they are close to the rim.
The basket is a separate complete skeletal mesh: I animate the complete structure on powerful dunks to simulate big impacts.

What I would like to have :

  • when appropriate, I attach the hands of the players to the rim
  • I play an animation on the player, to make him swing, his hands still grabbing the rim
  • I also play an animation on the basket structure.

A good example would be this video : https://www.youtube.com/watch?v=mz25SZaUnPI

Would you have any ideas on how to solve this?

Thanks!

Hey i whould create some sockets on the rim, and when the hand bones of the player where close enofe.
I whould attach the hand to the corosponding sockets on the rim,
am guesing Gravety and/or Physics whould need to be disabeld for the character to stay attached. (in the air)

I was thinkg of something like that.
But I don’t think it would be possible to attach just the hands. We can only attach an actor to another one I think.

The best would be to have the player have its swinging animation, and animating the basket structure would offset the player position.

You can attach hand sockets to rim sockets its defenetly possible.
I do the same thing for weapons, i attach the root component at the location of the socket.
Then you whould have to add the second hand right after or something.

So in essence its attached to the rim/ hoop but for all intens and puposes the player whould be hanging from his hand.
Correct me if am wrong someone. :slight_smile:

That’s the point. You attach the root component of an actor to the socket of another actor.

Here, the hands are not the root components. The capsule of the character is.

I think I’ll have to attach the root of the player to a new bone of the hoop structure (a child of the rim bone, located under it) and create animations of the player with the correct distance between this bone and the rim.

I’ll give it a try and let you know here

I quickly tried this evening to create a socket on the basket structure (it doesn’t have a skeleton yet) and attached my player to this socket and it works well. I just had to set the movement mode of the character movement component to Custom to disallow gravity.

Once I’ll have a skeleton for the basket, I’ll create a special node on which I will attach the player, and I’ll create various animations for the player with an offset on its root bone to compensate for the height to the rim.

I’ll try to not forget to show something here when I’ll do it successfully