First Person Shooter Gun Troubles

Blitz3D Forums/Blitz3D Beginners Area/First Person Shooter Gun Troubles

W(Posted 2005) [#1]
Alright here's the low down...I have a first person shooter, and everything is working great except for the loaded in weapon. When I get it to the appropriate place on screeen, it interacts with the enviroment. I know the gun shouldn't go through walls, or stop you from getting close to them. I have tried a few things and it is becoming very frustrating. Does anyone have a good hint or tip for me??

Here's some of my coding...
;-------------------------------------------------------
Type weapon
Field kind
Field x,y,z
Field model
End Type

Global pistol.weapon = New weapon
pistol\kind = 1
pistol\x = .10
pistol\y = -.15
pistol\z = 1.15
pistol\model = LoadMesh("gun.3ds,(user\cam))

PositionEntity pistol\model,pistol\x,pistol\y,pistol\z
ScaleEntity pistol\model,.50,.50,.50
;---------------------------------------------------------

To sum it up the gun is colliding with walls, and if I bring it closer to the camera then the gun no longer looks appropriate. Plz Help??


jhocking(Posted 2005) [#2]
Nothing collides unless you purposely turn on collisions for it. So just don't set EntityType for the weapon.


W(Posted 2005) [#3]
Thanks I got that, but now the gun still goes through walls when I get close to them, and goes through the ground if I look down??


jhocking(Posted 2005) [#4]
Oh, I see. Well, there are two approaches to the problem. The simpler one is to use EntityOrder to make sure the gun always draws last (and thus on top of the rest of your scenery. If it works this solution is @#!* easy, but the problem is that EntityOrder turns of z-buffering for that entity, so the rendering may look weird in terms of overlapping polygons. If that is the case, you can either re-design your weapon to solve the problem, or you can render the weapon as a separate pass on top of the main render.


jfk EO-11110(Posted 2005) [#5]
there 's a third, simpler method, simply scale the weapon to something very small and stick it clsely to the camera. Now make sure the weapon is inside the Players collsion elipsoid. Maybe you need to additionally shrink the gun a bit in its depth because when it's so closed to the lense, it may look stretched.


W(Posted 2005) [#6]
The entityorder command worked it's magic perfectly in my program much thanks to all!!!!!


jfk EO-11110(Posted 2005) [#7]
You'll probably get problems with animated gun meshes. Probably this can be solved when you set entityorder for the children recursively, in the order of their distance to the camera.