Trying to get physics collision data. (Jolt)

Godot Version

4.3

Question

Hi all!

I’m just trying to get my head around scripting physics with jolt in Godot.
I’ve started with a basic scene and I’m just trying to get info from the physics collisions.

I’m stuck just getting this basic information. Does anyone know why this might not be working? The reference is fine but it always seems to return zero.

	[Export] public RigidBody3D RigidBody3D;	

	public override void _Process(double delta)
	{
		GD.Print(RigidBody3D.GetCollidingBodies().Count);
	}

I’d like to get general information on the collisions too, is that possible?

Thanks,
Pete

PS - Hey there aren’t any physics tags in this forum, maybe that would be good to add?

1 Like

Hey cool thanks! Any ideas about those physics problems specifically?

Had you setted contact_monitor to true and setted max_contacts_reported to something higher than zero? If not, calling get_colliding_bodies will raise an error:

image

1 Like

Yeah that’s working! Thanks :slight_smile: