Integrating Cesium, Three.js, and a physics engine

Hi all,

I would like to build a walking simulator and I will need a physics engine (to prevent collision with objects, etc.). I am thinking of using cesium because I need to use realistic geospatial data as well as the built-in 3d models of building and other objects. I also need fine grained control of the camera since it will double as the “walker” (user should have the ability to pan up, pan down, look side to side, as well as move around the space)

Importantly, I will need a physics engine to prevent collision (I am thinking of using cannon.js). As far as I know CesiumJS does’t support the functionality of a physics engine. Lastly, this application needs to be browser based (a website).

I would appreciate any suggestions about how I might go about doing this. Is it possible to do all of this with just cesium (even preventing collisions)?

And if any one knows of any example projects, I would appreciate references to those.

Hi there,

You are correct in assuming that CesiumJS does not integrate any physics engine. This is why our plugins for Cesium Unreal and Unity have been useful; The geospatial functionality of Cesium complements the offerings of game engines.

CesiumJS should meet the requirements for loading geospatial data and fine grained camera control.

Three.js is likely not necessary unless you are looking to do more custom rendering that isn’t possible out of the box with CesiumJS. In the case you just want to use the geospatial operations from CesiumJS in a Three.js app, that should be possible as well.

Thanks for your reply, Gabby.

I have a followup question. I plan on creating custom 3D assest in Blender (such as buildings) that I will use instead of the out-of-the-box buildings that are found in CesiumJS. In this case, I would need to use three.js to render the blender assets. Is that correct?

Many thanks for your help.

It’s possible to use custom 3D assets in CesiumJS.

For a building, or other assets that don’t span a large geographical extent, you can load a glTF model asset. (This is also the recommended model format for Three.js, so the exported models would be compatible with either renderer.) I believe Blender allows you to export as glTF without any additional plugins.

I see. Thanks, Gabby. Could you point me to some documentation about 3d assets in CesiumJs (for my future referencce).

Many thanks for your help

Sure, here’s the CesiumJS learning center. Also, Sandcastle is a helpful resource for code examples.

1 Like