Static shape collisions
by Steve Kilcollins · in Torque Game Engine · 03/10/2004 (6:55 am) · 3 replies
Say I have a tree model. Can I create a box in front of the tree call it Col-1, a box behind the tree, Col-2, left - Col-3, right - Col-4. Can I then tell in script which collision the player hit? Or do I need to go into the actual code?
Reason I ask, I want to create 4 animations of the tree falling down (1 in each direction), then if I can tell which collision box the player hit, I can then kick off the animation of the tree falling in the correct direction.
Reason I ask, I want to create 4 animations of the tree falling down (1 in each direction), then if I can tell which collision box the player hit, I can then kick off the animation of the tree falling in the correct direction.
#2
-Ner
03/10/2004 (9:06 am)
If you have it available, I would think the vector of the projectile that hit the object would work best. Then you have the exact "angle" at which the object was hit. Not sure if that's in the engine or exposed through scripts though.-Ner
#3
Thanks for responsding Westy. I was thinking about the hitbox resource, but in a couple of threads that I read they were talking about bones and it pertaining to character models.
I must have missed the sidehit() function. I'll take a closer look at that resource.
@Dan
Thanks for responding Dan. It isn't so much for projectiles, but the character (which is tank) running over the static model. Tho, I should still be able to get the direction vector of the tank.
I thought it would be easy to get which collision box got hit. Tho, it might be better to do it the way you two have suggested. If I add 4 boxes that's an addition 48 faces (12 faces per box) and if I have lots of objects that's a lot more faces.
03/10/2004 (9:09 am)
@WestyThanks for responsding Westy. I was thinking about the hitbox resource, but in a couple of threads that I read they were talking about bones and it pertaining to character models.
I must have missed the sidehit() function. I'll take a closer look at that resource.
@Dan
Thanks for responding Dan. It isn't so much for projectiles, but the character (which is tank) running over the static model. Tho, I should still be able to get the direction vector of the tank.
I thought it would be easy to get which collision box got hit. Tho, it might be better to do it the way you two have suggested. If I add 4 boxes that's an addition 48 faces (12 faces per box) and if I have lots of objects that's a lot more faces.
Torque Owner Westy
it might be best to create code to check which side of bounds was hit and then decide from there..
This was done it a hitbox resource with a function called sidehit()
It wouldnt take much to get it working...