Camera looks inside of object if too near

Hi!



If the camera is too near an object, it looks inside of object.

Is there a way to that never happens? I would like “to let the nose touch in the wall and still see the wall”…



I found this workaround:

float mult = 0.01f;

cam.setFrustumNear(cam.getFrustumNear()*mult);

cam.setFrustumTop(cam.getFrustumTop()*mult);

cam.setFrustumBottom(cam.getFrustumBottom()*mult);

cam.setFrustumLeft(cam.getFrustumLeft()*mult);

cam.setFrustumRight(cam.getFrustumRight()*mult);

I just learned what frustum and culling means, what I coded above is mainly a guess and works well as long I dont let the cam get too near the wall.

I was stuck on this thought for weeks…

Or did I just answer what is possible to be done?

the default frustum near value is 1.0 (one ogl unit), i guess what you need, would be to attach a collision node to the camera, and set a 1 unit radius sphere as collision shape.



see here for a CameraNode implementation

http://hub.jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/cameranode/

I changed to 0.25 radius and changed the frustum stuff,

my initial tests with CameraNode didnt prevent it go thru objects…

Well til today I was only aware of physics node collision,

I think I have to study more, thx :slight_smile:

What you learned about physics collisions (or any collisions, really) is correct. There is nothing built into the Camera that will stop it from going through objects.