Hi,
How would I go about rotate a model to face the camera at all times?
Thanks for the help in advance.
Thanks,
Josh
Hi,
How would I go about rotate a model to face the camera at all times?
Thanks for the help in advance.
Thanks,
Josh
Solved!
const direction = Cesium.Cartesian3.subtract(camPos, modelPos, new Cesium.Cartesian3())
Cesium.Cartesian3.normalize(direction, direction)
const rotationMatrix = Cesium.Transforms.rotationMatrixFromPositionVelocity(modelPos, direction)
const rot90 = Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(90))
Cesium.Matrix3.multiply(rotationMatrix, rot90, model.modelMatrix)
This is exactly what I would need to do, but I don’t know how to use that code snippet. Could you give more context?
For example applied to the following example: Cesium Sandcastle. In my particular case, I would like the plane to remains horizontal, but with the cockpit always pointed the same way regardless of the camera orientation.
It would help me immensely.