PDA

View Full Version : Collision problem: Balls fly through the wall


Chrissy2009
05-06-2009, 02:55 PM
Hi,

I want create a billiard game inside a room. So I created a box in 3ds Max and set the viewpoint and the 15 balls into this box. This works very fine.

court = viz.add('world.wrl')
court.collideMesh()
....
ball.collideNone()
ballPhysicalShape = ball.collideBox()


But now my problem:
If I initiate the shoot, the balls fly across the room and always collide with the walls. This is okay!

But if I shoot them faster or if I set the bounce value from 0.5 to 2, they just fly through the wall.

I don't know what's the matter for this action.

Can anybody help me?

Thanks a lot.
Christina

Moh200jo
05-06-2009, 03:42 PM
Christina, I suggest to look at this script (http://www.worldviz.com/vizhelp/duckcourt.htm)

Chrissy2009
05-06-2009, 11:28 PM
Hey Moh200jo,

thanks for your answer, but I don't think this is my problem.

Look at the demo physics2.py:

You can shoot balls against the boxes. The MIN_POWER is 1 and for example the MAX_POWER is 80. This works all right. But if you change the MAX_POWER to 8000 you can see, that it will be possible to shoot the ball against the boxes, but they never collide. The ball ist too fast and will fly through the wall, without colliding.

The duckcourt.py has the same problem: If you change the BALL_SPEED from 5 to 500 and shoot a ball, you can see that the ball never collide with the ducks.

And exactly this is my problem. If I shoot the first ball too fast against the other balls, they collide and fly across the room. And because of their speed, they never collide with the walls.

Hope anybody can help me....

Moh200jo
05-07-2009, 04:52 AM
HI
Oh, I believe collision at vizard runs like this. I correct you have to play in your code to decrease the ball speed at exact distance between them. If you got something easier please let me know because I have this issue.

Chrissy2009
05-10-2009, 01:13 PM
Hi Moh200jo,

sorry but I didn't get this.

I ought to decrease the ball speed at which value? The distance between whom?

Thanks in advance!

Moh200jo
05-11-2009, 02:07 AM
well, just for any speed would be worked with your collision. the distance I have talked about which is between ball and wall (ROOM).
Hope this will help you.

Gladsomebeast
05-11-2009, 09:03 PM
Make the walls of your box bigger.

Gladsomebeast
05-11-2009, 09:04 PM
Bigger as in thicker.

Moh200jo
05-14-2009, 01:24 PM
Hi Paul,
I do not understand how this would does the collision; could you please provide me an example of this?
thanks

Gladsomebeast
05-14-2009, 01:48 PM
Each frame, the physics engine updates the position of the balls, then checks if the balls are touching other solid stuff. If the balls move so fast that they are on the other side of a wall, free and clear, then no collision is detected.

A thicker wall makes is more likely the ball is within the wall, a collision is detected, and the balls stay in the box.

Should fix things, but the physics system can be kind of crazy.

Chrissy2009
05-15-2009, 04:20 AM
Ah okay. Thank you for this information.

I'll make the walls thicker and will have a look what happens.

Moh200jo
05-19-2009, 04:38 AM
could you please post an example on this issue?