Game Development Community

How to re-use object collision

by Arden · in Torque Game Builder · 08/11/2010 (10:38 pm) · 2 replies

Hi folks,

I know how to create a specific collision in the Editor for an object, however I'm wondering how to instanciate an object with that specific collision from the script.

Must I clone a prototype object?

Any ideas?
Thanks

#1
08/12/2010 (1:57 am)
Yes, cloning is one option.

Another is to set the class on the object and use the onAdd callback and set the CollisionPolyList.

function MyClass::onAdd( %this )
{
  %this.CollisionPolyList = "-1 1 1 1 1 -1 -1 -1";
}

If you save your game with one of these objects, you can look at the level's .cs file and get the CollisionPolyList from that object. Then, back in the editor, go back and delete that object.
#2
08/12/2010 (3:48 am)
Awesome! I must say you are an active contributor to my threads :)
Thanks again William for your help.