Camera range and animated models.

Blitz3D Forums/Blitz3D Programming/Camera range and animated models.

I have this animated gun in a hand that I want close enough to the camera so that you don't see the chopped off arms but if I put the camera too close the model, it disappears. I tried messing with camera range to keep it in view to no avail. If I don't animate it I can get as close as I want. Any idea?

Have you tried messing around with 'entityorder' on the 'gun' so that it appears on top of everything?

Just tried it no luck. I'll keep fussing with it. Is there a good FPS example around here that shows the general idea?

From memory, using entityorder on complex meshes can cause polygon sorting/rendering glitches.

A better method might be to render your gun after rendering your level geometry i.e. one camera for your level geometry, a second camera to render your gun.

Another option is to scale down your gun, but bring it close to the camera - so that it appears at the correct scale, but the model is small and contained within your character's collision radius.

Another option which I have seen but which is less common, is to check if your gun is/about to clip with level geometry and have it 'lowered'.

You tried a near camera range of 0.1? Just checking.

Yep, tried that. Funny thing is that if I do not use Animate I can put the camera right up to the end of the barrel of the gun and it is fine.

Isn't there a command that can change the bounding box on animated entities to avoid this?

perhaps MeshCullBox mesh,x#,y#,z#,width#,height#,depth# ?? I'll try it in a bit. I assume x,y,z are the center of the mesh.

Yep, that works! Thanks MadJack!

Is there a good FPS example around here that shows the general idea?

I believe there's one in the Samples collection of B3D itself (i.e. on your computer, not this website) I think it's either called "shooter" or "scare", something like that.

I looked at that before posting, nice example of general concept but it did not have the hands or weapon.