How would I achieve something like this?

I want to achieve like a little swing system. I know I have to use Body Forces and a swing animation for this, but I have no clue how to detect that the player is near a swing part…
Any tips would be appreciated!

Is it possible to just use Touched event and detect if the player arms are touching them?

You’d have to use Raycasting when the player presses the spacebar.
Then do whatever you want with the BodyForces.

Possible, but I’m not sure how I could play the animation from there where the player touched the part. you saw how the arms of the Eoblox character where perfectly aligned with the parts and it actually looked like a perfect swing? If I would user a Touched Event and detect if the Arms touched the Part I could be the arm position near of my characters shoulder got touched. Then the Animation would play and it would look like I’m floating in the air (because my hands don’t grab the part). Correct me if I’m wrong!

I guess you’re right, you could use attachments and raycasting as the second reply aforementioned.

Raycast forward from both the character’s upper torso and near their feet every frame. If none of the two rays connect then there’s nothing in front of the character; if both rays connect then the player is facing a solid wall and thus can’t swing; if the upper torso ray hits something while the legs ray don’t then the player may perform a swing. Stop the character’s velocity, calculate their initial position based on the upper torso ray’s impact point, then play the animation. Propel the character forward when the animation ends and apply a cooldown.

FYI BodyMovers are now deprecated. Consider using constraints instead.

1 Like