Can you use DOTs for physics and game objects for navigation on different objects in the same scene

I am making a game where players build vehicles from blocks - a bit like the game Besiege.

The blocks and vehicles will be physics based, and I am thinking of using DOTS for this.

The player will be able to control and test their vehicles against AI soldiers, which will use the navmesh to move around.

Is it possible to use DOTs physics for the blocks used to make the player’s vehicle, but keep the AI soldiers as game objects, so that they can use the navmesh navigation system to move around the map?

Also, would it be possible to convert the AI soldiers to DOTs ragdolls if they are killed by an explosion, so that they can realistically react to the blast?

Thank you for your help.

Hi @DromoDesigner , you can choose “Convert and Inject Game Object” in “Convert To Entity” component to keep the game object alive during simulation. The code in “UnityPhysicsSamples\Assets\Common\Scripts\EntityTracker.cs” can help with copying entity transform into game object.

Please note that GameObject and DOTS updates are not synchronized, so there might be some quirks, but feel free to try the combination. Good luck, please let me know if you need help down the road!

1 Like

Hi milos85miki, thank you for the information. “Convert and Inject Game Object” sounds exactly what I need!

In the game I am making, players will have a design mode, where they put blocks together to make a vehicle. Then they press a button to enter play mode, where they test and drive the vehicle. Only ‘Play mode’ needs to have physics, which will be used to simulate driving the vehicle.

Is it possible to use standard game objects for the building blocks in ‘Design mode’, and then when the player starts ‘Play mode’ use “Convert and Inject Game Object” to turn the blocks into entities to make the physics based vehicle?

Doing it this way could make the game easier to make. Do you think this would work, or would you have a suggestion for a better way of doing it?

Thanks again for your advice!

I think conversion needs to happen at scene conversion time, but if changes are done only to the gameobject, it should be possible to run conversion again when you need it and update the entity. It’s best to ask on general DOTS subforum (parent of DOTS physics), though, those folks should know much better than me.