Software Request please - Physics Starter Kit
by Andy Hawkins · in Artist Corner · 08/14/2008 (7:26 pm) · 15 replies
I would like to request a physics starter kit that leverages the existing rigidbody physics available in Torque.
I would like to suggest it has the following
Examples of
- various objects, chair, box, ball
- various rigidbody types. hinge, joint, ball and socket etc
Code snippets
- datablocks of the aforementioned that work out of the box
- simple room which demonstrates the objects.
For the one who knows how to do this I think you could make 20 to 30 dollars per pack and you would be a god within the GG community. And for that person, who knows how to do, I can imaging it wouldn't take that long for you to whip out some balanced datablocks. Contact me if you want art support.
Please consider :)
I would like to suggest it has the following
Examples of
- various objects, chair, box, ball
- various rigidbody types. hinge, joint, ball and socket etc
Code snippets
- datablocks of the aforementioned that work out of the box
- simple room which demonstrates the objects.
For the one who knows how to do this I think you could make 20 to 30 dollars per pack and you would be a god within the GG community. And for that person, who knows how to do, I can imaging it wouldn't take that long for you to whip out some balanced datablocks. Contact me if you want art support.
Please consider :)
#2
I'll see if I can whip up a working example this weekend. I've played with this a little.
08/14/2008 (7:56 pm)
Quote:hinge, joint, ball and socket etcThese aren't in the engine. Currently, You would have to use a third party lib. to get them.
Quote:Why not a few different types of boxes (heavy/light) , why not things like swings that move with weight (is this even possible with rigid body ?)
I'll see if I can whip up a working example this weekend. I've played with this a little.
Quote:What does rokkitball use for its main ball ? A rigidbody ? Why not tell us the process of adding/tweaking a similar setupThey use a ball setup as a player model and have animations for forward, backward, and side.
#3
08/14/2008 (8:10 pm)
Wow thanks mike, look forward to some examples. Didnt realise they dont use a rigidbody, any idea why they went with the player model setup ? Less problems ?
#4
08/14/2008 (9:46 pm)
That's great thanks Mike. Even just boxes and spheres would be good.
#5
08/14/2008 (9:59 pm)
Wow... that will be really great.
#6
08/14/2008 (10:11 pm)
Yeah this would be a really great thing for this community.
#7
Actually the ball in Rokkitball is a customized version of the Marble from Marble Blast Ultra. It is a custom spherical rigid body that Mark Frohnmayer and Clark Fagot collaborated on. At this point in time it isn't available as part of the SDK.
Little known fact: the ball in the original prototype for Rokkitball (then called BoomBall) was actually a tweaked Item from the SDK. The second prototype used a stock RigidShape which worked fairly well.
08/15/2008 (10:45 am)
Quote:
They use a ball setup as a player model and have animations for forward, backward, and side.
Actually the ball in Rokkitball is a customized version of the Marble from Marble Blast Ultra. It is a custom spherical rigid body that Mark Frohnmayer and Clark Fagot collaborated on. At this point in time it isn't available as part of the SDK.
Little known fact: the ball in the original prototype for Rokkitball (then called BoomBall) was actually a tweaked Item from the SDK. The second prototype used a stock RigidShape which worked fairly well.
#8
08/15/2008 (11:01 am)
I think that having a starter kit with these items setup, ie, a box, a pushable object, a bouncable object, wieghted moving objects(ie ropes that swing when hit, and dont stop just when mounted) things like that. There is the ragdoll kit. But Torque lags behind many other kits by not offering good examples to impliment at least core functionality. Same with ai, though AIseek looks interesting. More starter Kits addressing some of these short fallings would be very nice. Another example would be cloth phyics. I have seen some code. But never got it to work.
#9
But what I would like to see would be more things like hinges, joints, and ball and socket physics. Which would have to added to the engine. The idea of swinging objects without using fixed animation sequences is a good one. I would love to have swinging ropes and chains that a player could use.
08/15/2008 (3:34 pm)
Moving boxes, chairs, balls, etc are rather simple using the rigidshape physics. The bouncing boulder example in the demo can be tweaked for some good bouncing object type things. I'm no expert, but a little time tweaking the different values in the datablock and coming to understand what they mean is a great learning experience. I'm currently working on implementing movable and destroyable objects (with bouncing debris) using rigidshape physics for someone else, but I would be willing to share some example code when it's done. And these are all simple things that can be controlled in script.But what I would like to see would be more things like hinges, joints, and ball and socket physics. Which would have to added to the engine. The idea of swinging objects without using fixed animation sequences is a good one. I would love to have swinging ropes and chains that a player could use.
#10
08/15/2008 (4:51 pm)
But I think the datablock tweakage is the stalling point right there. It would be better to have examples that "just work" so people can learn from them.
#11
Seems like everyone wants it , even a well layed out rigid shapes pack for sale would be awesome. Free is always better though :)
08/15/2008 (5:48 pm)
Yeh in the long term, definetely support for hinges e.t.c would be awesome. But in the short term a simple demo map with a few types of rigid objects would be a great starting point.Seems like everyone wants it , even a well layed out rigid shapes pack for sale would be awesome. Free is always better though :)
#12
Oh cool. Ok. Sorry for the assumption.
08/16/2008 (2:17 pm)
Quote:Actually the ball in Rokkitball is a customized version of the Marble from Marble Blast Ultra. It is a custom spherical rigid body that Mark Frohnmayer and Clark Fagot collaborated on. At this point in time it isn't available as part of the SDK.
Oh cool. Ok. Sorry for the assumption.
#13
And here is the ::onCollision function that I'm currently using, based on code from Zod's MG Starter Kit
08/17/2008 (2:29 pm)
Quote:But I think the datablock tweakage is the stalling point right there. It would be better to have examples that "just work" so people can learn from them.Here is a working pushable barrel/crate object attuned to the mass of the player in the starter.fps, and using stock assets. You will need to tweak the various settings for other projects and other uses. Keep in mind that odd shaped objects will have peculiar behaviour.
datablock RigidShapeData(Barrel)
{
category = "Destroyables";
shapeFile = "~/data/shapes/barrels/FBarrel01.dts";
emap = true;
// Rigid Body
density = 0.975; // if less than water density then object will float/bob in water
mass = 100;
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.5;
bodyRestitution = 0.1;
minImpactSpeed = 2;//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.05;
dragForce = 0.05;
vertFactor = 0.05;
normalForce = 0.05;
restorativeForce = 0.05;
rollForce = 0.05;
pitchForce = 0.05;
//dustEmitter = "";
triggerDustHeight = 1;
dustHeight = 10;
splashEmitter = "PlayerSplashEmitter";
splashFreqMod = "300";
splashVelEpsilon = "0.60";
exitSplashSoundVelocity = "";
softSplashSoundVelocity = "2";
mediumSplashSoundVelocity = "5";
hardSplashSoundVelocity = "8";
softImpactSound = "ImpactLightSoftSound";
hardImpactSound = "ImpactLightHardSound";
exitingWater = "ExitingWaterLightSound";
impactWaterEasy = "ImpactLightWaterEasySound";
impactWaterMedium = "ImpactLightWaterMediumSound";
impactWaterHard = "ImpactLightWaterHardSound";
waterWakeSound = "FootLightWadingSound";
};And here is the ::onCollision function that I'm currently using, based on code from Zod's MG Starter Kit
function RigidShapeData::onCollision(%data, %obj, %col, %vec, %speed)
{
//error("RigidShapeData::onCollision(" SPC %data.getName()@", "@%obj@", "@%col.getClassName()@", "@%vec@", "@%speed SPC ")");
// if it is colliding with itself or the terrain then ignore it
if (%obj == %col || %col.getType() & $TypeMasks::TerrainObjectType || %speed < 1)
return;
if (%col.getType() & $TypeMasks::ShapeBaseObjectType)
{
if (%obj.lastCollider = %col)
{
// we just ran into this, lets give it half a second before we apply another impulse
if (getSimTime() - %obj.lastColTime < 550)
return;
}
%velocity = %col.getVelocity();
%normal = vectorDot(%velocity, VectorNormalize(%velocity));
if(%normal < 15)
%multi = 8;
else
%multi = 8 / %normal;
%objPos = %obj.getPosition();
%colPos = %col.getPosition();
%vec = VectorNormalize(VectorSub(%objPos, %colPos));
%force = VectorScale(%vec, %col.getDatablock().mass * %multi);
%obj.applyImpulse(%objPos, %force);
%obj.lastCollider = %col;
%obj.lastColTime = getSimTime();
}
}It should be a simple matter for you to do a raycast linked to a 'use' action in order to pull the object towards/with you as you move backwards.
#14
08/17/2008 (6:02 pm)
Hey they works pretty well - sometimes they fall through the terrain though. How can I implement a push? When I stand against one right now it doesn't move - I need to ram it to move it.
#15
www.garagegames.com/blogs/63061/15294
08/18/2008 (8:50 am)
Mike has generously offered a sample pack here... thanks Mike.www.garagegames.com/blogs/63061/15294
Torque Owner Ian Roach
Rigid body physics is not very well represented in the engine, not in either the walkthroughs or the default starter kits. Also doco is lacking on how to tweak the physics and effects.
Why not a few different types of boxes (heavy/light) , why not things like swings that move with weight (is this even possible with rigid body ?)
What does rokkitball use for its main ball ? A rigidbody ? Why not tell us the process of adding/tweaking a similar setup.
What about pulling/pushing a rigid body, what are the steps involved for such a thing ?
If GG arent interested in providing a real physics solution to its engines, why not explain abit more the inbuilt physics you have now ? Most people still rely on the original resource for rigid body, not even realising its built into the engine, or anyway to actually use it.
Has anyone out there experimented much with rigid body ?