entityorder issue

Blitz3D Forums/Blitz3D Beginners Area/entityorder issue

hello, again.

I am having trouble with entityorder for a gun I have in my program. I don't want it to pass through walls but when I turn entityorder on like this

entityorder gun,-1

it draws the gun in reverse, meaning I see my players on the other side of the gun, when they are supposed to be blocked from view by the gun.

This is all related to z-order disabling.

Best to use a second camera, render the gun cam last without clearing the main cam render. Set cameraclsmode to retain z-order and clear colour.

okay, I'm a bit confused, I haven't used cameraclsmode before. could you give me an example?

Here's the function I use for creating a heads up display camera. The comments in the function will give you more info on its use. Just parent your gun to the camera and then position the gun to where you want it displayed in the camera's local space.

Function CreateHudCamera( order, x#, y#, z# )
; USAGE:
; Creates a camera to be used for a heads-up display.

; PARAMETERS:
; order - This sets the drawing order of the camera. 'order' should be a negative number, so that the HUD camera is drawn on top of the main camera graphics. The highest value negative number will be drawn last (eg. The '-2' camera will be drawn after the '-1' camera.).

; x#, y#, z# - Set the camera's absolute world position. The position should set so that the camera and its associated 3D graphic objects do not interfere with any other cameras.

; RETURNS:
; The new HUD camera's entity handle is returned.


	Local cam = CreateCamera()
	PositionEntity cam, x#, y#, z#, True ; 
	CameraRange cam, 0.2, 5.0
	CameraZoom cam, 1.6
	EntityOrder cam, order
	CameraClsMode cam, False, True ; This prevents the background graphics from being overwritten by the camera's clearscreen color.
	Return cam
End Function