Game Development Community

Creating Assets for Physics

by raa brubb · in Torque 3D Professional · 01/25/2014 (12:01 pm) · 7 replies

Hey all, so I'm a little bit confused now that I've installed Bullet Physics. So I installed Bullet Physics, and I don't quite know how to make Soft Bodies using Bullet Physics or Rigid Bodies all using Bullet Physics in Torque3D. Do I make .bullet files or something? Is the RigidBody included using Bullet Physics?

#1
01/25/2014 (1:40 pm)
Anyone know?
#2
01/25/2014 (2:04 pm)
You need to define a PhysicsShapeData datablock for a physics shape, like this:

datablock PhysicsShapeData( PSCube )
{	
   category = "PhysicsShape";
   shapeName = "art/shapes/cube/cube.dae";
   emap = 1;

   mass = "0.5";
   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;
   
   friction = "0.4";
   linearDamping = "0.1";
   angularDamping = "0.2";
   buoyancyDensity = "0.9";
   staticFriction = "0.5";
   
   radiusDamage        = 0;
   damageRadius        = 0;
   areaImpulse         = 0;
   restitution = "0.3";
   invulnerable = "0";
   waterDampingScale = "10";
};

Then create a PhysicsShape with that datablock and it should just work when load the level. If you don't see anything, check the console and it will tell you if bullet is not loaded, etc.

Edit: physics shapes need collision meshes or they won't load. Keep that in mind.
#3
01/25/2014 (3:12 pm)
So I'm a little confused. I looked at the rigid body sample object "BouncingBoulder". It still works without Bullet Physics. What is starting and stopping physics in Bullet do? What is even the purpose of it if physics already works? I thought in order for soft bodys and OpenCL you needed Bullet and that was the advantage of using Bullet in T3D. Everything was calculated using Bullet after it was coded in. So what does Bullet do in the editor?
#4
01/25/2014 (4:08 pm)
Raa,

PhysicsShapeData is kind of a side job that allows for a few eye candy type of things such as barrel splinters to bob up and down on water after an explosion. The reality, for me anyways, is it really is a waste of time and effort unless you plan on only making a straightforward (and really watered down)FPS. PhysX is full of undocumented glitches, and disables commonsense collisions that are really necessary for even many FPS games.
I would recommend, even to FPS creators, that unless you know how to modify PhysX on your own, then keep it out of your game.
#5
01/25/2014 (4:53 pm)
I really hate to be a pain, but I'm self learning 3D. I'm doing pretty good, but I'm not a professional. Using Torque physics, rigid bodies are possible as shown in Bouncing Boulder. What changes when Bullet Physics is integrated? The things I need for my FPS is, well, the normal physics. Soft bodies, Rigid bodies, Physics Collision, and Physics Destructables. Meaning, when shooting a mesh (as example) it's pieces fly everywhere. I know PhysX does that, but I will NEVER use PhysX because of bad CPU coding and no GPU offloading on AMD cards. Bullet was my alternative, but I don't quite know what I can now do with it and how to make assets abiding by Bullet Physics. That is what I'm asking.
#6
01/25/2014 (8:48 pm)
raa,

I believe you can do anything you want that PhysX provides through mere script -- no coding involved. As an example, I am currently creating a step by step process resource for the community that describes how to create an airship with collision meshes if you made the mistake of using a PhysX build. I*f you want crap flying off of things when shooting it then scrip it on the onCollision process of weapons fire. The doll-like concepts for the killed enemies can be done through a mixture of script and animation as well.
#7
01/25/2014 (9:28 pm)
Well, you probably can but for this project I just want to use Bullet, so what changes when Bullet Physics is integrated? The things I need for my FPS is, well, the normal physics. Soft bodies, Rigid bodies, Physics Collision, and Physics Destructables. Meaning, when shooting a mesh (as example) it's pieces fly everywhere. If anyone could clear things up that would be great.