Game Development Community

Rigid Shape Class *.cs...

by Max Thomas · in Torque Game Engine · 11/23/2004 (7:49 am) · 7 replies

Hello all,

I was lookin at his resource Here and just can't manage to get it to work. I'm sure there is somebody out there who has a full *.cs version of "RigidShape.cs" out there and was wondering if they would be kind enough to send it to me please.

Thanks, Max ;)

badsnax@gmail.com

#1
11/23/2004 (9:53 am)
Sure

Here is my rigidShape.cs
// Hook into the mission editor.

function RigidShapeData::create(%data)
{
   // The mission editor invokes this method when it wants to create
   // an object of the given datablock type.
   %obj = new RigidShape() {
      dataBlock = %data;
   };
   return %obj;
}

and the I got a boulder.cs

datablock RigidShapeData( BouncingBoulder )
{	

   category = "RigidShape";
	
   shapeFile = "~/data/shapes/boulder/boulder.dts";
   emap = true;

   // Rigid Body
   mass = 200;
   massCenter = "0 0 0";    // Center of mass for rigid body
   massBox = "0 0 0";         // Size of box used for moment of inertia,
                              // if zero it defaults to object bounding box
   drag = 0.2;                // Drag coefficient
   bodyFriction = 0.2;
   bodyRestitution = 0.1;
   minImpactSpeed = 5;        // Impacts over this invoke the script callback
   softImpactSpeed = 5;       // Play SoftImpact Sound
   hardImpactSpeed = 15;      // Play HardImpact Sound
   integration = 8;           // Physics integration: TickSec/Rate
   collisionTol = 0.1;        // Collision distance tolerance
   contactTol = 0.1;          // Contact velocity tolerance
   
   minRollSpeed = 10;
   
   maxDrag = 0.5;
   minDrag = 0.01;

   triggerDustHeight = 1;
   dustHeight = 10;

   dragForce = 0.05;
   vertFactor = 0.05;

   normalForce = 0.05;
   restorativeForce = 0.05;
   rollForce = 0.05;
   pitchForce = 0.05;
};

More or less whats written in the resource, but there you have it :-)
#2
11/23/2004 (10:40 am)
Thanks,

I saw that. But is there anything else that I need? It just seems a little too simple to get workin... Well I'll try that and see what I get.

Max :)
#3
11/23/2004 (11:09 am)
Oopsey doubble post.
#4
11/23/2004 (10:24 pm)
Hey Max

Its all you need (besides the engine changes) to get the basics running. You can now spawn a rigid shape in the mission editor and see it tumble down a hillside

To interact with it, you need to use onCollision() with applyImpulse() to the rigid shape (examples in the resopurce - you need to play around with the impulse vector length to get the right force depending on your rigid shape mass). But thats basically it.
#5
11/24/2004 (8:18 am)
Ummm... One question. I put that code in their respective files execed them put the shape in but I can't find them in the mission edditor. I can only find em in the static shapes folder.
#6
11/24/2004 (10:47 am)
They should appear in the Shapes folder.

Are you certain you compiled your engine correctly?

I just added the resource to a clean head 3 days ago without any hitch.
#7
11/24/2004 (12:28 pm)
Hello again,

Still problems not showig up. I know that I'm compiling corectly too. Well, do you thik you could please send me your shapebase.cc please? Well, thanks for all the help.

badsnax@gmail.com

Thanks, Max ;)