Interact with rigidBody

Godot Version

Godot v4.

Question

Now I’m trying to find a way to interact with this cart. But I don’t know how to pull it and fix the pulling arm to the character’s hand

I mean I want to do it like the following picture

I have searched many videos on how to make a car but it is just a normal driving car but now I want to make it with a trailer. But I also had a basic understanding and was able to make a car using RigidBody

image

Is there any way to:

  1. Fix the vehicle’s handle to the player’s hand
  2. Let the player pull the cart

Is there any way? Thank you

Have you tried putting a pinjoint on the handle and setting it’s node_b path to the player when equipping?

1 Like

I think it is not working :frowning:
also node_b is not working
image

image

pin joint requires paths

pin_joint_2d.noda_a = player.get_path()

Make sure to paste code between three ticks

```
type or paste code here
```

1 Like

So what it mean ??

Invalid set index 'noda_a' (on base: 'PinJoint2D') with value of type 'NodePath'.

This is my code

@export var player : CharacterBody2D
pin_joint_2d.noda_a = player.get_path()
1 Like

noda_a doesn’t exist. I mistyped, should be node_a. Thank you for pasting your code.

Omg this is working! Thank you very much :3

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.