How can I render the gun close to camera without having it cut of by the fustrum?

Hi!

I got this gun attached to a node, attached to my character.

Problem is that the gun is so close to the camera that half of it is cut of and now shown.

So what I want to do is have the m16 being renderd on top of everything.



I’v already tried multiple ways of achiving this:

gun.setCullHint(Spatial.CullHint.Never);

or

gun.setLastFrustumIntersection(FrustumIntersect.Intersects);



Nothing seems to work.

If I change the cam.setFrustumNear(.1f); but that only makes it all look alot weared.

I want the classic fps view without the cut that the jme render does.



I belive there was a way in jme2 but not sure if its in jme3 yet… Help?

hello addez,

if u are trying to create an fps, that only the gun is displayed it should be attached to the guiNode.



I am also interested in someone answering your question, because this happens to me also and its irritating when i go near a wall it gets disappeared because i am too close. But in AAA games this doesn’t happen, so how did they manage it ?

I think the default near frustum plane is set to 1 meter. You can change it to be closer on Camera. It’s not 100% straight forward, though… do a forum search for setFrustumPerspective() maybe and you will find examples. If you don’t use that call then I think it messes up the camera FOV if you just set the near value directly.

SOLUTION FOUND :smiley:

To set the fustrum do this:



float ratio = 1024/768;

cam.setFrustumPerspective( 45, ratio,.1f, 1000f);



1st setting is the view angle.

Set to the default 45 degrees.



2nd is the ration.

ratio is decided by the width/height of the window. The window containing the 3d parts, the one that pops up after the settings screen.



the 3rd value is the near property.

Setting it too low will make it look like your wearing REALLY strong glasses :stuck_out_tongue:

But setting it to low is the key to fixing the cut-weapon problem :slight_smile:



The 4th value is the far property.

Its at its default, 1000 wu.





Hope this works for you too tralala :slight_smile:

wow cool, you fixed it now all walls show properly !!!