Generated Collision Poly
by Ian Omroth Hardingham · in Torque Game Builder · 01/24/2007 (12:58 pm) · 2 replies
Hi everyone.
Just playing around with TGB, completely new to it.
I've got a class inheriting from T2DStaticSprite which randomly generates a convex polygon as it's shape. I've got the generating and rendering done, but now I'm trying to set the size of the thing and set the custom collision poly.
I create it with:
What format does the custom poly need to be in? I have it as a list of points whose coordinates are %s of size, so each between 0 and 1, but am having no luck so far.
Any help would be greatly appreciated.
Ian
Just playing around with TGB, completely new to it.
I've got a class inheriting from T2DStaticSprite which randomly generates a convex polygon as it's shape. I've got the generating and rendering done, but now I'm trying to set the size of the thing and set the custom collision poly.
I create it with:
new MyClass(Blah) {
imageMap = "playerShipImageMap";
frame = "0";
canSaveDynamicFields = "1";
class = "Asteroid";
position = "400 20";
size = "1 1";
mountID = "2";
scenegraph = $pShip.scenegraph;
CollisionActiveSend = "1";
CollisionActiveReceive = "1";
CollisionGroups = "-33";
CollisionResponseMode = "BOUNCE";
};[code]
Then in c I do the following:
[code]setSize(newSize);
setCollisionPolyCustom(nPoints, points);What format does the custom poly need to be in? I have it as a list of points whose coordinates are %s of size, so each between 0 and 1, but am having no luck so far.
Any help would be greatly appreciated.
Ian
About the author
Designer and lead programmer on Frozen Synapse, Frozen Endzone, and Determinance. Co-owner of Mode 7 Games.
Torque 3D Owner Stephen Zepp
In which class method are you doing the size change Ian, and why directly in c++?