Collision Items
by Ivan Lai · in Technical Issues · 03/05/2008 (4:48 am) · 12 replies
Hi Everyone.
I am new to Torque.
I have been reading through tutorials and did some modelling and coding.
I tried creating a cube with a collision mesh.
After which, I added the cube as an ItemData.
In the World Editor, I created the cube and let it roll down hill towards the player.
The cube stops when it hits my player.
The strange thing happens when my player tries to move and it moves right through the cube.
Thinking I might have modelled wrongly, I used someone else's model from some tutorial and get the same result.
So my question is whether Item actually allows Player to pass through them.
If so, how can I make 2 cubes interact with each other physically?
I am new to Torque.
I have been reading through tutorials and did some modelling and coding.
I tried creating a cube with a collision mesh.
After which, I added the cube as an ItemData.
In the World Editor, I created the cube and let it roll down hill towards the player.
The cube stops when it hits my player.
The strange thing happens when my player tries to move and it moves right through the cube.
Thinking I might have modelled wrongly, I used someone else's model from some tutorial and get the same result.
So my question is whether Item actually allows Player to pass through them.
If so, how can I make 2 cubes interact with each other physically?
#3
I can help you...
I am seasoned Artist.Torque game engine..
my mail: szzg007@163.com
MSN:zzhuzhenguo@hotmail.com
03/16/2008 (6:37 am)
You can send your 3DMAX file for me...I can help you...
I am seasoned Artist.Torque game engine..
my mail: szzg007@163.com
MSN:zzhuzhenguo@hotmail.com
#4
03/16/2008 (7:32 pm)
Hi all, when i use rigidShape class i can't put my model (boulder.dts) in the expected position. I want to build a billiard game so what kind of class i should use for my balls to detect the collision and simulate it. Thanks
#5
03/16/2008 (7:41 pm)
Yeah, you'll need to tweak the physics...a lot.
#6
03/16/2008 (9:12 pm)
I have the model pooltable.dts which has five collision meshes (collision-1 --> collision-5). how can i control the collision among five collision meshes.
#7
Why not?
Did tweaking the datablock help?
And in any case, any behavoir that you don't like would need to be addressed in rigidShape.cc.
03/16/2008 (10:33 pm)
Well, to answer that question, I kinda have to ask another question. What happens when you use the RigidShape class? You said you couldn't place it where you wanted it.Why not?
Did tweaking the datablock help?
And in any case, any behavoir that you don't like would need to be addressed in rigidShape.cc.
#8
03/16/2008 (11:59 pm)
Thanks for answering me Lee. When i use the RigidShape class for my billiard ball and put it on the table, it jumps up and move to another position. I will change every forces in the RigidShapeData to zero but it still jumps up. Please help me
#9
You will, in the end, need to do some hacking on the physics. It's pretty primitive, and will not work/look like a real pool table even with optimal datablock values (although that will help, and you will have a game you can play with and work on).
I seem to recall it's important to set the mass pretty high to achieve the most realistic actions. The db for my port-o-potty might be a good place to start (other than the shape, of course).
03/17/2008 (12:38 am)
Download my game (check my profile) and you will find a ridigshape.cs file there. Unfortunately, the models aren't in the current distribution, but it will give you some datablock values to try out.You will, in the end, need to do some hacking on the physics. It's pretty primitive, and will not work/look like a real pool table even with optimal datablock values (although that will help, and you will have a game you can play with and work on).
I seem to recall it's important to set the mass pretty high to achieve the most realistic actions. The db for my port-o-potty might be a good place to start (other than the shape, of course).
#10
and blued20 that it inherits from:
The blue d20 was, obviously, a 20 side die that I wanted pretty light. The portopotty I wanted to act "larger"
03/17/2008 (12:40 am)
Just so no one will accuse me of shilling, here's the portopotty db and the db it inherits from:datablock RigidShapeData( portajohn : blued20)
{
category = "RigidShape";
shapeFile = "~/data/shapes/portajohn/portajohn.dts";
emap = true;
// Rigid Body
mass = 20;
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 = .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;
//minRollSpeed = 1;
maxDrag = 0.5;
minDrag = 0.01;
triggerDustHeight = 1;
dustHeight = 10;
dragForce = 0.05;
vertFactor = 0.05;
normalForce = .1;
restorativeForce = 0.05;
rollForce = 0.05;
pitchForce = 0.05;
};and blued20 that it inherits from:
datablock RigidShapeData( blued20 )
{
category = "RigidShape";
shapeFile = "~/data/shapes/danddice/blued20.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 = 1; // Physics integration: TickSec/Rate
// collisionTol = 0.1; // Collision distance tolerance
// contactTol = 0.1; // Contact velocity tolerance
collisionTol = 0.6;
contactTol = 0.6;
bodyFriction = 0.6;
bodyRestitution = 0.1;
//minRollSpeed = 10;
minRollSpeed = 1;
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;
};The blue d20 was, obviously, a 20 side die that I wanted pretty light. The portopotty I wanted to act "larger"
#11
new SimGroup(Balls){
canSaveDynamicFields = "1";
new rigidShape() {
position = "451.5 300.5 230";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "BallData";
};
};
Please help me soon
03/25/2008 (7:51 pm)
I download your game but i couldn't find the information i want. In your game you have the rigidShape.cs but where do you create the rigidShapeData. I think if i want to put my rigidShapeData in my game i have to declare like this in my missionnew SimGroup(Balls){
canSaveDynamicFields = "1";
new rigidShape() {
position = "451.5 300.5 230";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "BallData";
};
};
Please help me soon
#12
Try adding one via the Mission Editor, and then you can examine the mission file for syntax.
I think that's basically right, though.
03/25/2008 (8:51 pm)
Sorry about that, I'm not using it currently but I thought you just wanted some starter datablock values.Try adding one via the Mission Editor, and then you can examine the mission file for syntax.
I think that's basically right, though.
Torque Owner Lee Latham
Default Studio Name
Items, at least by default, don't do physics when colliding with players, but act like a type of trigger.