How to make an extremly simple grappling hook in 3D?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 20xxdd20

I want to make a simple 3D grappling hook which only get attached to specific objects (like a black cube) and just uses the player’s momentum. No Hookes Law and such, the grappling hook is a solid piece basicly.

like just cause where you go to the object or like spider-man games?

lewis glasgow | 2021-08-11 13:17

One of the simplest ways to set up a player attractor like a grappled–object is to just lerp the player’s Vector3 translation to that of the object. So you might set a Raycast when the player clicks/grapples and if the ray hits a PhysicsBody, then:

player.translation = lerp(player.translation, raycast.get_collision_point(), lerp_speed)

Yuminous | 2021-08-11 13:34