Setting checkpoints on a race track using SceneComposer


I am currently setting my checkpoints programmatically using “Box shaped” Geometry objects that the player must cross in order to validate a checkpoint.

This is a bit tedious and I would like to use the SceneComposer to add the checkpoints.

Once I have positioned my Geometry objects onto the scene, how can I import them into my program ?

Is it possible to define a property of my scene which would contain the list of checkpoint objects and that I could

query programmatically ?

I do something similar here:

In-game I scan for the markers using spatial.depthFirstTraversal()


How did you create the .J3o files that you use as Markers ? I’d like to add simple box mesh to my scene but I don’t see how to do it using the SceneComposer

I make a new j3o and changed the UserData, then saved it. Adding via right-click → add to scene composer

I managed to create a simple box mesh in Blender that I import into my scene and position as checkpoint.

The problem is that my player control collides with the box.

How can I make my imported box Node non collidable (I just need to be able to use BoundingVolume.intersects() to detect a checkpoint cross) ?

I tried to remove the Node from the PhysicsSpace but it doesn’t work.

Alternatively, how can I make the box mesh non collidable directly in Blender ? Any pointer to some good Blender doc would be appreciated.

… why do you use a box? just use an empty node… in the scenecomposer you will see it though the widget and when loading it you can just retrieve the location and then do whatever you need to do.

I have implemented your Empty node solution and it works. Thanks for that.

I am using the BoundingVolume of a Box Geometry to detect when the player has gone through it i.e. crossed a checkpoint.

The reason I’d rather position the box directly in the SceneComposer is that it makes it easier to orientate the box compared to orientating it programmatically.

How come the PhysicsSpace.removeAll(spatial) doesn’t make my spatial non collidable ? Is there a bug that needs to be fixed ?

If you enabled it with addall it can be disabled with that too. But it can only manage the first physics control on any object.

I’ve added the box node from the SceneComposer. It seems sufficient to enable it in the PhysicsSpace since my control collides with it.

If you do addAll(rootNode) and then directly removeAll(rootNode) they will all be added and then removed, unless you add other physics controls to the scene in between. Does that spatial you call removeAll() with have a PhysicsControl attached at all? Or is it maybe some sub-spatial, like a geometry from a collision. Then it isn’t necessarily the one with the PhysicsControl.

The spatial doesn’t have any PhysicsControl attached, nor its sub-spatial - I have checked using spatial.getNumControls()

In fact the question might be how come a spatial without any control attached can be collidable, and how to make it non-collidable ?

Well the physics object is still in the physics space then, you will have to remove it. If already removed the physics control from the spatial, then ofc the removeAll method cannot find it via the spatial and will also not remove it.

But how do I remove an object without a control from the PhysicsSpace ?

I don’t see such method in the PhysicsSpace interface.