limit the jit.gl.camera range of motion
Hi! I have a jit.gl.camera inside a 3d model room. If I move too much I pass through the walls, I would like to limit the range of movement of the camera to avoid this problem. Can you help me? Thanks in advance
Using maths, here is a way to constrain the camera into a 20x20x20 cube centered at the origin, going from -10 to 10 on the X, Y and Z axis.
And another one where the camera cannot leave a sphere of a given radius (controls seem a bit glitchy on this)
And you can find more flexible but not easier to implement options, based on jit.phys objects, in this thread.
I gave this another try with using the collision system of the jit.phys.world built inside of jit.world.
Works OK but still not perfect, and needs kind of a wacky trick to detect when objects aren't in collision anymore.
Avantage of this logic is that you can adapt it so the camera also avoid collisions with other 3D objects. Here the camera cannot enter in the torus, and cannot get outside of the world boundaries.
Unfortunately, not being an expert in jitter, I struggle to understand and implement this system well with a 3D OBJ model. Thanks so much for your help anyway