Game Development Community

Removing Ability to Collide at runtime?

by Rich Hudson · in Torque X 2D · 10/08/2007 (10:18 am) · 1 replies

An enemy dies and I dont want it clogging up the map (turn collision off - but not unregister object), I have tried all kinds of things, such as:

enemyCollision.OnCollision = null;
enemyCollision.ResolveCollision = null;
enemyCollision.CollisionLayerMask = 0;

where

T2DCollisionComponent enemyCollision = deadEnemy.Components.FindComponent();

#1
10/08/2007 (3:12 pm)
You'll also need to set SolveOverlap to false. That said, you need to make sure that your dead enemies are no longer receiving tick callbacks as well so you don't incur as much CPU overhead.