Manipulate a datablock
by CodingChris · in Torque Game Engine · 11/23/2006 (5:51 am) · 2 replies
Hi,
I want to change a datablock, via script. My datablock:
I want to change a datablock, via script. My datablock:
datablock RigidShapeData( BouncingBoulder )
{
category = "RigidShape";
shapeFile = "~/data/shapes/boulder/boulder.dts";
emap = true;
// Rigid Body
mass = 1;
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 = 4; // 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;
};Now how to change the mass via script?About the author
#2
I once heard that you shouldn't change datablocks once they are loaded, so keep that in mind.
11/23/2006 (2:22 pm)
Here's what I would do:new RigidShape(myBoulder)
{
datablock = BouncingBoulder;
};
function lightenRock()
{
myBoulder.datablock.mass = 3;
}I once heard that you shouldn't change datablocks once they are loaded, so keep that in mind.
Torque Owner Robert Seeman
For example:
BouncingBoulder.mass = 2;