Game Development Community

Weapon in the wall

by Thomas Bang · in Torque Game Engine · 05/08/2008 (7:37 am) · 7 replies

Hi

Is there a way to prevent the weapon enter the wall (or other DIF/DTS)?

A solution could be to move the weapon more to the player dependent of the distance between Weapon and wall, house,whatever... ( Westwood did this with Command & Conquer Renegade).

But i would be glad to see another solution... a parameter in a datablock like prevent_zorder = false/true;


Greetings


Thomas Bang
Germany

#1
05/08/2008 (7:43 am)
I've been meaning to fix this myself, but it shouldn't be too tough if you don't want to wait on me. You can do it several ways - either by playing around with the nearplane/farplane before and after drawing the weapon, or by clearing the zbuffer (in this case, you would have to draw the weapon last). Or, you could use stencils (etc). All of these would require minor code changes in the engine. If someone has a scripted way to do it, I'd be interested also.
#2
05/08/2008 (8:43 am)
I haven't done it with TGE, but in another engine I just expaned the bounding/collision box on the forward plane of the player as a simple hack to the problem. Not elegant, but quick. Not sure if that's enough for your application, or if it's even doable in TGE...
#3
05/08/2008 (8:51 am)
A engine modification would be better because the script's should only include all the gameplay stuff and not engine-workarounds.

Before TGB and TGE i worked with Conitec's Gamestudio. There can you write:

my.znear = on; // or off ... "my" is the same as %obj in Torque

A normal object property could do the job.
#4
05/10/2008 (11:05 pm)
Torque already has retraction node code - if you butt up against a wall, your weapon is just pushed backwards into your character by the appropriate amount. They did this in Tribes (and Tribes 2?). I don't know how to set this up, but you should be able to find some resources on TDN (particularly the DTS node listing PDF).
#5
05/11/2008 (9:40 am)
If you can find the Yorkshire Rifles demo, he has a really good implementation of what you're looking to get, in which the gun points down based on how close to the wall you are.
#6
05/13/2008 (10:23 am)
Now, that's a good idea. Maybe instead of using retraction nodes, modify the Player's look animation based on proximity to a wall. If they're already looking down, modify it to point up (they'll be jamming their gun into the floor).
#7
05/13/2008 (10:46 am)
Actually I didn't do anything "knowingly" to stop the player's weapons from pressing into the wall.

So I figure it must be from the way I modelled the weapons. I used bones for the "muzzlepoint" and "mountpoint", the muzzlepoint extrudes from a central bone called "base" and the weapon's mesh is grouped with the mountpoint. No idea if this is responsible as this was really my first go at 3D modelling.