Game Development Community

Physics Oddity ...

by David Higgins · in Torque Game Builder · 08/16/2006 (11:50 am) · 5 replies

I've been trying to toss together a really simple billiards demo, but I keep running into a small quirk that is bothering me quite a bit.

If I place 9 balls at the end of the 'table', then place another ball (cue) on the opposite end and then apply an impulse force, or a static force set in the TGB physics panel of the object ... then hit F5 to play the 'game' ...

the collision of the cue into the 9 balls resting on the other side of the table appears to be totally random ... I would have expected that if the cue was resting in the same place at the start of each game, as well as the other 9 balls, and the same force was applied each time, the same reaction would occur ... but this does not seem to be true as the cue will sometimes make the balls move faster or slower, or move in different directions.

Granted, the response every time appears realistic, especially since a 'shot' like this is more or less impossible (absolutely the same setup every time) ... but being as it's all calculated ... I would assume that the response would be the same every time, until I change the angle or force that is applied.


Can anyone explain this randomness? As it is confusing and both worrying me ... if I were to build a billiards game and rely on the built-in physics within T2D ... I would expect the responses to be fairly exact in exact situations.


Also, why was the Mass/Density/Friction/etc items removed from the Physics roll-down in the object's Edit tab? And why is "RIGID" no longer available in any of the response modes -- the change log says that it was removed from the World Limit responses (which I disliked, I would have preffered to keep RIGID world limits, any reason behind removing this that is logical?) but made no mention of it being removed else where ... I can force RIGID within code, but I liked the ability to be able to simply throw together a quick "level" and test things with point-and-click functionality ... now i have to write code as well to test physics ...


Thanks,

-- Dave

#1
08/16/2006 (4:18 pm)
Yet another item of curiosity ...

I placed a series of graphics in my level, one of them is the table graphic which is, for the time being, just a simple 900x450 PNG that is a solid greenish coloring to simulate the table top/cloth ... another is an image I created that is just simply a rectangular object that is currently colored brown to simulate the rails of the table.

I placed four copies of this rail image around the table top image and all four rail images are touching corners (or at least they appear to be visually) ... they do not overlap, however.

In some cases, when a ball hits the corner at the right angle, the ball and the rails collision responses appear to be getting confused as to what to do as the ball hits both the left and bottom rail 'simultaneously' as is the case sometimes in a billiards game (I have no pockets in this particular simulation, so the corners are fair game).

When this confusion arise, the ball appears to instantly 'jump' from the corner that it hit and immediately attaches itself to the inside of the rail object ... I was originally using World Limits for the balls, but as of 1.1.1 RIGID is no longer a valid World Limit response mode (unless it was only removed from the drop-downs but can still be forced through script as is the case with collision response modes ... where rigid is no longer a drop-down option, but is a valid script option ... ???)

Anyhow, this drastically affects the outcome of the simulation as the ball now appears off the table and the next 'shot' simulation has no ability to reach this object anymore ...

both rail objects are set to immovable but have collision send/recieve and physics send/recieve enabled ... the same is true for the ball objects as well.


UPDATE -- After turning off 'Send/Recieve' physics on the Rail objects, this issue appeared to have stopped occuring -- though it was fairly complicated to replicate this issue (I basically just kept re-running the game over and over until it happened again ... )
#2
08/16/2006 (4:59 pm)
I was curious about the RIGID being removed too. I found you can edit the t2d and put it back and it seems to function, but it will leave the dropdown blank. Thats about all I know thus far.
#3
08/16/2006 (5:02 pm)
I did the same, editting the t2d level file ... if the engine however is running at the time you edit this file, it overwrites it the next time you save the level (which occurs each time you run the game).

I simply over-came this issue by adding in a %this.CollisionResponseMode = "RIGID" into my object's onLevelLoaded(...) method ...

Seems an oddity ... perhaps an oversight ... or they forgot to mention this in the changelog ...
#4
08/16/2006 (5:04 pm)
Considering the functionality still exists I would assume it was a GUI oversight.
#5
08/16/2006 (5:26 pm)
Have you tried setting the World Limits to RIGID ...


%this.setWorldLimit("BADMODE", 0.0, 0.0, 0.0, 0.0, false);

Causes an "Invalid World Limit" error to be printed to the Console

%this.setWorldLimit("RIGID", 0.0, 0.0, 0.0, 0.0, false);

does not error ... and appears to make the object respond properly ...

Was it "removed" only from the drop-down options to more or less force developers to script out the settings ... or was removing it as an actual valid option yet another over-sight or a backwards compatibility option for 1.1.0 games?