Local to Global Coordinates

I’m creating a naval warfare game that uses CesiumJS to show the 3d battlefield. I’m trying to launch weapons and aircraft from ships. But, right now, they launch from the centre of the ship.

I’d like to able to translate local model coordinates to pick a point on the ship (flight deck or a weapons launcher) where the aircraft or weapons would be launched. This would be similar to computing the local emitter model matrix when we create particle systems.

Can you give me some advice or point me to a resource where I can figure out how to translate the local coordinates back to global coordinates, which would be the point where the subunits (aircraft/weapon) would be created, taxi to, and finally, launch from?

Thank you!

Hi Luan,

If you multiply the model’s modelMatrix by the local coordinates that should give you the global coordinates. If that doesn’t work for whatever reason, try using model._computedMatrix instead.

Also note that the glTF model is probably y-up, so you’ll want to define the local coordinates as y-up.

Thanks for all your help Sean!