Gun model clipping through walls

Blitz3D Forums/Blitz3D Beginners Area/Gun model clipping through walls

Kippykip(Posted 2013) [#1]
I heard of EntityOrder
but then the models bits within the model are visable
I just want to make the gun model not clip through the ground/wall

any ideas?


Kev(Posted 2013) [#2]
been a long time since i used blitz so could have this wrong, parent a sphere/cube with apha zero and set the collision to sliding, make it bigger than your gun.

kev


Matty(Posted 2013) [#3]
Lots of ways of doing this.

Multiple render passes is another way.


RemiD(Posted 2013) [#4]
I would do 2 renders, one for the meshes between 1,1000 and one for the meshes between 0.001,1, and also use EntityOrder -1 on the weapon so it does not appear to be in the wall, or maybe use a bigger collider sphere for the player.
A combination of the previous suggestions :)


Kryzon(Posted 2013) [#5]
With multple renders like Matty said you don't really need to change the camera near and far values, just the clear mode.

You set a CameraCLSMode(Camera, False, True) when drawing the gun so you clear the depth buffer but keep everything that's been previously drawn.

The sequence would be:
[bbcode]
;When rendering:

;Scene pass (no gun or GUI).
CameraCLSMode(Camera, True, True)
HideEntity Gun : HideEntity GUI : ShowEntity Scene
RenderWorld()

;Gun and GUI pass (no scene).
CameraCLSMode(Camera, False, True)
ShowEntity Gun : ShowEntity GUI : HideEntity Scene
RenderWorld()[/bbcode]"GUI" is considered your entire layer of 2D-in-3D gui graphics (like SpriteControl for instance), which would need to have a smaller EntityOrder value than the gun (if the gun is 0, the gui would be -1).
"Scene" is considered everything else but the gun and gui.