Camera Collisions
Camera Collisions
what is the simplest way to keep a camera from passing through entities
Re: Camera Collisions
You could create a dynamic entity that represents the 'body' of the camera. User input would be used to change the velocity of the entity, and the camera's view matrix would be updated based on the entity's position each frame.
You may end up wanting to make the entity unaffected by gravity, using the entity.isAffectedByGravity = false flag. Additionally, if you don't want the camera entity to rotate, you can set its localSpaceInertiaTensorInverse to the zero matrix.
You may end up wanting to make the entity unaffected by gravity, using the entity.isAffectedByGravity = false flag. Additionally, if you don't want the camera entity to rotate, you can set its localSpaceInertiaTensorInverse to the zero matrix.