Game Development Community

Is it possible to dynamically remove components from an object?

by Stephanie Miller · in Torque X 2D · 04/11/2010 (3:00 pm) · 3 replies

When my player dies, I want it to stop colliding with specific objects, but keep colliding with others. Is this possible to do? [solved]

About the author

Recent Threads


#1
04/11/2010 (5:31 pm)
Unfortunately you cannot remove components in TX.
What you can do is change your player's object.CollisionsEnabled property to false.
#2
04/11/2010 (5:46 pm)
If you want the object to collide with some types of object, but not others, then you need be setting the CollidesWith property of the T2DCollisionComponent. Objects can be assigned TorqueObjectTypes and the collision component can be set to only collide with objects of the correct TorqueObjectTypes.
#3
04/11/2010 (9:23 pm)
Actually, I think I just figured it out:

SceneObject.Collision.CollidesWith -= ObjectType seems to work.


Thank you :D