I want to create a grappling hook or "ninja rope" type device. Has this been done before in zdoom?
I imagine this could work like this:
1. Fire the weapon; wherever it hits, the bullet puff remains.
2. When the player is farther than the rope length from the puff, adjust player's velocity.*
3. When the player hits another key, the grappling hook detaches. Maybe pressing jump reels the rope in, and releasing jump detaches the hook.
* Originally I wrote "transfer all downward velocity into sideways velocity, towards the puff," but this doesn't seem right. The new velocity should maybe directed along a line tangent to a sphere with a radius of rope length, centered around the puff. Not sure exactly how the math would look, would appreciate any pointers.
Questions:
- Will the physics as described above feel anything like a ninja rope?
- How to draw the rope in a convincing way?
- How to handle air control / swinging yourself on rope?
Alternate idea:
Thinking more about drawing the rope, it seems like it would need to be a sort of chain of actors.
If that needs to happen anyway, maybe those actors can provide the physics themselves, by fixing one end to the puff, one end to the player, and the rest of the links in the chain to the two adjacent links. The actors will be affected by gravity, and a script will run constantly, enforcing distance between each link and its neighbors.
This could add a lot of realism, like bending the rope around corners, without any complicated math. I wonder how many links in a chain like this the engine could reasonably handle?
Not exactly sure how to enforce closeness. I'm thinking just walk through each chain link, and if it's too far from the next link, propel those two links towards each other by some constant amount (more elastic rope at lower values). And maybe let the chain links push each other around?
Anyway, just brainstorming I guess. If anyone has any ideas, let me know