Collision with Interior
by Quest Johnny · in Torque Game Engine · 08/16/2004 (7:21 pm) · 4 replies
Is it possible to register an event on Collision with an interior as you do with a static shape? There is an InteriorObjectType, but no datablock, unless PathedInteriorData is the one? I would like to be able to throw a script callback when a player is in contact with an interior.
About the author
#2
Unfortunately, the player is not throwing onCollision for an interior.. any idea why?
08/17/2004 (6:18 am)
Yes, so theoretically when the player collides with an interior, I should get an onCollision call on the player at least.Unfortunately, the player is not throwing onCollision for an interior.. any idea why?
#3
I'm very sorry. I managed to mislead you on that one.
You'll have to use onImpact() if you want to record a player vs. interior collision:
Note: You'll probably have to reduce your minImpact speed if you want this to fire all the time on impact. Of course, by doing that, you'll be messing with other stuff.
Note2: I took a fast look at the code and it looks like the player will only call oncollision for: Triggers, Corpses, Items, and PhysicalZones... take a peek at: findContact() in player.cc.
So, you can at least work around this with onImpact(). If I find out more, I'll re-post OK?
[HOW]EdM|EGTGE
PS - minImpact is in the PlayerData datablock.
08/17/2004 (10:51 pm)
Andrew,I'm very sorry. I managed to mislead you on that one.
You'll have to use onImpact() if you want to record a player vs. interior collision:
function PlayerData::onImpact(%this, %obj, %collidedObject, %vec, %vecLen)
{
}Note: You'll probably have to reduce your minImpact speed if you want this to fire all the time on impact. Of course, by doing that, you'll be messing with other stuff.
Note2: I took a fast look at the code and it looks like the player will only call oncollision for: Triggers, Corpses, Items, and PhysicalZones... take a peek at: findContact() in player.cc.
So, you can at least work around this with onImpact(). If I find out more, I'll re-post OK?
[HOW]EdM|EGTGE
PS - minImpact is in the PlayerData datablock.
#4
08/18/2004 (12:34 am)
You could just add the InteriorType to the player class so that it will call onCollision when you collied with one (I assume its not too hard, havnt looked at the code).
Associate Edward F. Maurina III
Roaming Gamer LLC
Projectiles, Items, Players, Vehicles, ...
Hope this helps.
[HOW]EdM|EGTGE
PS - An example onCollision callback defition:
ItemData::onCollision( %DB , %Obj , %Collider ){
// %DB - ItemData datablock ID
// %Obj - Item ID
// %Collider - Object colliding with or being collided by the Item. Your interior...
}
Note also, Projectile::onCollision() returns where you hit the object.