I don't have much experience coding in java, but I'm familiar with coding itself, as I'm an expert at actionscript3. I need to make a simple-ish dual grapple system (as seen in "Attack on Titan" see link---> [3D Maneuver Gear][1] - [Grapple system in action - jpeg][2]) to move around an environment.
I'm planning on using a rope prefab, basically a thin and long cylinder that you can adjust the length of with code, and a third-person character prefab. So here's how this will work:
1. the player's grapple gun is point **A**. When a button is pressed, the rope prefab appears in the direction of the crosshair and plays an animation of a shot. the length of rope prefab is always in front of the gun itself, but i think that can be handled with animations.
2. when (and if) the prefab hits a tagged object, it replaces itself with another of the same rope prefab that connects point **A** (the grapple gun) to point **B** (the object). this new prefab is the same prefab from before, but the length is the distance from point **A** to point **B** and there are no active animations.
3. next, force is applied to the player in the direction of point **B**, but the force is included with (or "on top of") all the other forces affecting the player (wind, jumping or running, explosions, the player's own weight/gravity, etc), and the player (which the grapple gun is a child of) is moved *along the rope* prefab to point **B**. All the while, the rope is getting shorter by frame according to the player's distance from **A** to **B**. (this can be set by one line of code updating each frame, or a function executing only when grapple key is pressed to when point **B** is reached)
//note that point **A** will always be the gun, and point **B** will always be a *tagged* object.
I just need a little bit of pointers in the right direction, if this is possible or not, if some elements should be revised or scrapped. If it's possible, actual code will help alot. Note that the verbal schematic is only for one grapple gun, and there will be two per player, so the variables might need to be named accordingly. The gun is a child of the player, not the player itself.
Thanks for any feedback
[1]: http://shingekinokyojin.wikia.com/wiki/Three_Dimensional_Maneuver_Gear
[2]: http://livedoor.4.blogimg.jp/nizigami/imgs/2/c/2c9f9021-s.jpg
↧