finepointcgi / FinepointCGI-Suggestions

MIT License
4 stars 0 forks source link

Grappling Gun / Hook #35

Open eweninja opened 1 year ago

eweninja commented 1 year ago

I don't know why, but it seems like some people like Gappling gun mechanic in 3D games for fast moving or effective traveling with the First Person Controler. In 3D it can be as simple as:

  1. Casting ray from camera node.
  2. Checking if ray cast is coliding with something after is_action_just_pressed.
  3. If ray cast is colliding let's get this point.
  4. Disable gravity and move/lerp player to the point.
  5. If player is close enough enable gravity and disable moving/lerping.

Tutorial can be also combined with enabling grappling to another point while the player is in air or offseting y of collision point a little to give player the ability to get on the edge of block/element that is grappling to.

As an additional tip you can add that if colliding with ray cast object is for example rigidbody, then the object will be pulled to the player, not the player to the object.

In 2D it can be more challenging because of differences in implementing controls, but it also can be covered as a separated tutorial.