Combining response modes
by Tetraweb · in Torque Game Builder · 02/19/2007 (7:00 pm) · 9 replies
I have a ball bouncing around with BOUNCE response mode, which I need to have, and put a few sprites in the area with RIGID response mode, thinking that the sprite would respond to a collision with the BOUNCE ball with rigid physic response, but it sits there unmoved.
So I assume that combining a RIGID collision receiver with a BOUNCE collision sender simply will not work. Yes?
Greg
So I assume that combining a RIGID collision receiver with a BOUNCE collision sender simply will not work. Yes?
Greg
#2
Greg
02/20/2007 (3:57 am)
Yes, I have it so the ball, though it is set with BOUNCE is still sending physics information//the balll gets set with this on loading
$theball.setMass(0.8);
$theball.setRestitution(1.0);
$theball.setFriction(0);
$theball.setCollisionPhysics(1,1); //send , recieve
$theball.setCollisionActive(1,1);
$theball.setCollisionResponse(BOUNCE);
//and the block with rigid physics get sets with this datablock
CollisionActiveSend = "0";
CollisionActiveReceive = "1";
CollisionPhysicsSend = "1";
CollisionPhysicsReceive = "1";
AutoMassInertia = true;
Damping = 0.2;
ForceScale = 1.0;
Friction = 0.3;
Restitution = 1;
CollisionResponseMode = "RIGID";Greg
#3
02/20/2007 (2:09 pm)
Just to clarify: The naming convention for Send Physics and Receive Physics are a little deceiving. If Send Physics is enabled, then this object will have a physics response when it sends a collision. If Receive Physics is enabled, then this object will have a physics response when it receives a collision.
#4
Perhaps tellingly, if the ball hits the block hard and just on the corner, it does send the block spinning, but usually it just bounces off without imparting any force whatsoever.
Greg
02/20/2007 (3:08 pm)
I think I understand. In my settings above, both objects are set to send and receive so I should be seeing physics responses on the block, right?Perhaps tellingly, if the ball hits the block hard and just on the corner, it does send the block spinning, but usually it just bounces off without imparting any force whatsoever.
Greg
#5
Check your settings, and remember ... "1" and "10" are dramatically different -- being as most settings are in "0.01" increments ;)
02/20/2007 (5:55 pm)
If the ball can hit the block and make it spin, sounds like your blocks moment of inertia is too high -- ie; your block weighs a lot more then your ball, and your ball has little to no effect on your block ... Check your settings, and remember ... "1" and "10" are dramatically different -- being as most settings are in "0.01" increments ;)
#6
Scenario A:
Object 1:
response mode BOUNCE
send and receive collision
send and receive physics
linearvelocity of about 80
Object 2:
response mode RIGID
only receive collision
only receive physics
Result: object 1 bounces off object two, imparting no (or occasionally a tiny amount) of momentum to object 2.
---
Scenario B:
Object 1:
response mode BOUNCE
send and receive collision
only receive physics
linearvelocity of about 80
Object 2:
response mode RIGID
only receive collision
only receive physics
Result: object 1 imparts a great deal of momentum to object 2, sending it spinning, but is itself unaffected, continuing in a straight line.
I would like object 1 to also be effected by the collision in scenario B, but perhaps it is the bounce mode which is preventing it?
Greg
02/21/2007 (8:03 am)
I'm still a bit confused. Setting aside the factors of density, mass and inertialmoment, which I have tweaked quite a bit, in a nutshell I have this:Scenario A:
Object 1:
response mode BOUNCE
send and receive collision
send and receive physics
linearvelocity of about 80
Object 2:
response mode RIGID
only receive collision
only receive physics
Result: object 1 bounces off object two, imparting no (or occasionally a tiny amount) of momentum to object 2.
---
Scenario B:
Object 1:
response mode BOUNCE
send and receive collision
only receive physics
linearvelocity of about 80
Object 2:
response mode RIGID
only receive collision
only receive physics
Result: object 1 imparts a great deal of momentum to object 2, sending it spinning, but is itself unaffected, continuing in a straight line.
I would like object 1 to also be effected by the collision in scenario B, but perhaps it is the bounce mode which is preventing it?
Greg
#7
I would suggest a custom response -- the logic behind 'bounce' is fairly simple ... you just negate the angle that the object was in when it made the collision
So if the object was travelling at a 45 degree angle up, you negate it to a -45 up ...
You can do this in the onCollision()
It sounds like the bounce/rigid response modes are in fact conflicting, which does not really surprise me since last I checked RIGID had lots of issues to begin with ;)
02/21/2007 (6:17 pm)
@Tetraweb,I would suggest a custom response -- the logic behind 'bounce' is fairly simple ... you just negate the angle that the object was in when it made the collision
So if the object was travelling at a 45 degree angle up, you negate it to a -45 up ...
You can do this in the onCollision()
It sounds like the bounce/rigid response modes are in fact conflicting, which does not really surprise me since last I checked RIGID had lots of issues to begin with ;)
#8
02/22/2007 (4:07 am)
Isn't rigid the only mode that uses impulse at all? (ie sum mass * velocity of all objects constant that are involved in a contact?) And without impulse, always the no-impulse side will get "everything" as the impulse side can not be altered as it is the only part of the sum.
#9
In the ball onCollision, I am giving the hit object an impulse %force of the collision normal, with a %speed of the current ball speed / 2. This works perfectly.
I am also setting the angular velocity to a small random number to give it a slight spin, just the look I was after.
I assume there is no angular equivalent of setImpulseForce? In other words, a setImpulseAngular which would give apply a spin, but not completely overwrite its existing spin. Not a big deal, as I can just get its current angular velocity and modify that before reapplying it, but it would be a bit better if I could do it in one line instead of three.
Greg
02/22/2007 (6:07 am)
@David, I think your tactic is going to work fine. Instead of having the object have RIGID response, I have it with CUSTOM.In the ball onCollision, I am giving the hit object an impulse %force of the collision normal, with a %speed of the current ball speed / 2. This works perfectly.
I am also setting the angular velocity to a small random number to give it a slight spin, just the look I was after.
I assume there is no angular equivalent of setImpulseForce? In other words, a setImpulseAngular which would give apply a spin, but not completely overwrite its existing spin. Not a big deal, as I can just get its current angular velocity and modify that before reapplying it, but it would be a bit better if I could do it in one line instead of three.
Greg
Associate David Higgins
DPHCoders.com
Send Collision
Send Physics
Recieve Collision
Recieve Physics
Ok -- 4 options ... which ones to enable on which objects, depends on the result you want -- but for RIGID BODY to work, it has to know what the physics of both objects in the collision were.