issues with colision on lantern

4.3 Stable

put the obligatory “im new to godot” here

so im having an issue that i cant seem to fix
i have a player holding a lantern that is parented to the player and always moves to a marker3d, i want it to have collision with the environment but not the player
if the lantern isnt parented, the lantern lags behind the player, which looks stupid, and ive tried doing col layers and masks but it just dosent work
image
heres my hierarchy as it is, ty

Does a pin joint 3D work to affix the lantern?

no, its just parented to the player and uses the 2 marker3ds to move the correct way

What is the exact issue you are having, What do you expect to happen vs what really happens?

Have you tried setting the lantern to a different collision mask than the player’s collision layer? I would recommend setting the “World” to layer 1, “Player” to layer 3, and “Lantern” or other dynamic objects to layer 4.

Then the Player can mask 1, the Lantern can Mask 1, and the world can mask 3 and 4.

Parenting may result in poor collisions, I would recommend using a PinJoint to follow the player while keeping rotation and optional slack when moving. If you really want to keep your physics based script toward the markers then you will need to adapt them to un-parenting. You may need to set the process order to reduce a one frame delay.

the goal is to have the lantern move with this code

	if lightout == true:
		lantern.set_linear_velocity((hand.global_transform.origin - lantern.global_transform.origin)*5)
	
	if lightout == false:
		lantern.set_linear_velocity((lanternSide.global_transform.origin - lantern.global_transform.origin)*5)

it works perfectly when parented to the player, but when its parented to something else it lags behind, i want it to stay the same relative to the player, but be affected by this code when the player moves the camera around.
also i tried doing a pinjoint but i just have no clue what the hell goes wrong so im scared of it
when doing a collision mask, it legitimate just didnt work, it would either
a) collide with nothing (which is what it does currently)
b)collide with everything including the player, even if the player and the lantern are on different layers, this seems to stop happening when its re parented so doing that would likely fix this too.
im sorry if im bad at explaining things

Could you show your scene tree with the pin joint added? Here’s a basic setup I’ve had success testing just now. Pin Joint “Node A → Player” and “Node B → Lantern” are the only properties I assigned.

2024-12-16-185003_240x195_scrot

May need to see the collision masks for each object too, I’m betting the world and player ended up on the same layer therefor you couldn’t mask the world or the player individually; In my example and all my games I make sure to put the world on layer 1 and the player on layer 3, other things on their own layer, such as the lantern on 4. Then the lantern can mask the world (1) without masking the player (3).