Game Development Community

Checking the object type in a collision

by Kyle Keene · in Torque X 2D · 02/15/2010 (6:24 pm) · 4 replies

Hi, I'm rather new to TX2D and I have a quick and probably simple question. How would you check the object type of the object that's being collided with?

Basically, what I'm trying to do is create a platformer. I want to have my object hit the ground and then a variable resets back to what it originally was (which is 0). I've got down what I need to do after it checks what type of object my object collided with, but I do not know how to actually check what object type was collided with.

So in short, can someone explain how to check the type of an object that was collided with?

#1
02/15/2010 (6:41 pm)
Did you do any of the tutorials? You can set object collision types in the T2DCollisionComponent. The OnCollision delegate that you create will have the object you collided with.
#2
02/15/2010 (6:44 pm)
Check out this thread ... perhaps it will help.

http://www.torquepowered.com/community/forums/viewthread/57618
#3
02/15/2010 (6:54 pm)
Yes I've done the tutorials. I knew you could set object types in the T2DCollisionComponent, but I guess what I'm asking is how do I create a custom collision delegate that handles the collision based on object type?
#4
02/15/2010 (10:20 pm)
You can get the object type of the "theirObject" theirObject.ObjectType
then do what you will with it.

If I were you I'd spend the $30 and get the TX platformer kit.