Making Players Behave Like Normal Physics Objects
Posted: Fri Jun 29, 2018 5:27 pm
So I'm working on a grappling hook script which allows players to swing around on ropes. However, I've run into a pretty big problem. My original script simply created a distance joint between the player and the "anchor", but because of the way players behave they don't really swing, they just very slowly drift downwards. My original solution (and the best I've come up with so far) was to create a glass shard (it could be any object, but I chose this one at random) at the player's position attached to the rope, and update the player's velocity and position to be equal to that of the shard. This makes the player follow the behavior of a normal physics object. The problem with that is that it makes the player jitter around a bunch due to the way that SetWorldPosition() works. My second solution takes advantage of the fact that a tumbling player has no special physics, and so I just bonk the player in the back of the head with a rock when they start swinging, which makes them tumble and follow physics. The problem with this is that you can't act while in this state, so you can't grapple and swing into a ledge grab, attack, shoot, etc. It also prevents multiple consecutive swings. What I want is for players to follow the physics of a normal object while still being able to attack, shoot, grab ledges, block, etc. Is there any way to do this?
Thanks in advance.
EDIT: I have achieved a similar thing to what I wanted by binding the player to a StoneDebris00A object which swings. It's still slightly jittery, but much better now. Regardless, if anyone does know how to accomplish what I asked above I would love to hear it as it may work better or be cleaner than my solution.
EDIT #2: I have uploaded the new version on sfdmaps if anyone is interested in testing it out
Thanks in advance.
EDIT: I have achieved a similar thing to what I wanted by binding the player to a StoneDebris00A object which swings. It's still slightly jittery, but much better now. Regardless, if anyone does know how to accomplish what I asked above I would love to hear it as it may work better or be cleaner than my solution.
EDIT #2: I have uploaded the new version on sfdmaps if anyone is interested in testing it out