For some reason my rigid body 3d dont want to work

Godot Version

4.4.1

Question

i need to make it so the player would die when colliding with objects that are in “tree” group but it doesnt work. I tried making it with shape cast 3d but i couldnt get object group and then tried using rigid body 3d and it doesnt colide. Could someone “combine” those functions into 1 or atleas make it work please.

copyable code

func _physics_process(delta):
	var dead = Global.global_dead
	steering = lerp(steering, Input.get_axis("right", "left") * 0.4, 5 * delta)
	engine_force = Input.get_axis("back", "forward") * doamovespeed 	
	if isdead == false:
		if dead == true and iswinstate == false:
			print("DEAD")
			doamovespeed = 0
			Global.eliminated = "[pulse]" + Global.playername + " has been eliminated."
			$detect_dead / RichTextLabel2.show()
			freeCam()
			$sheep.queue_free()
			$CollisionShape3D.queue_free()
			$Node / Camera3D3 / freecamlisten / Explode.play()
			$Node / Camera3D3 / freecamlisten / explosion.play()
			isdead = true
	if Global.global_dead == false and Global.global_sheep == 0:
		if won == false:
			win()
			won = true


func _on_rigid_body_3d_body_entered(colider):
	print("help")
	if colider.is_in_group("tree"):
		Global.Global_dead = true
		print("AAAAAAAA")

Does “help” or “DEAD” print? Did you enable contact monitoring on the rigid body?

1 Like

Prints dont work, i didnt enabled contact motion

When i turned it on it worked but i need to make both functions being able to change “dead” value

I did some things snd its working! Ty!

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