may I ask you a question please? #46
Replies: 1 comment 1 reply
-
The ground box's top is at y = 0 and has a total width of 1 unit; the sphere starts at y = 16 and has a radius of 1. If the sphere is traveling more than 1.5 units per timestep at the time it reaches the ground, it may go through because bodies move in discrete steps by default. Given a distance of 15 from the bottom of the ball to the top of the ground and a gravitational acceleration of 200, the ball reaches the ground in about 0.39 seconds. The ball's speed at that point is around 77.5. Since your time step is 1/30, the displacement per time step is about 2.5. It can easily skip straight through the ground in one timestep. To address this, ideally you would use shorter time step durations. For example, if you could afford 1/120, the sphere would only move around 0.65 in a single timestep, which is insufficient to tunnel. (Of course, if you drop from an even greater height with no velocity limit, it may still tunnel.) You can also enable continuous collision detection by changing the entity's |
Beta Was this translation helpful? Give feedback.
-
Hello, may I ask you a question please? Previously, I set TimeStepDuration of a new physical space as 1/30m and its gravity as -9.81m. Then, I created a ball in it, the mass of which was 100m and the gravity of which was -200m. The result was the ball would pass through the ground. Could you please tell me the reason of it? Or, how should I adjust the parameters to stop the ball from passing through the ground while not changing the ball’s mass and gravity?
The code is as follows:
Space = new Space();
Space.TimeStepSettings.TimeStepDuration = (Fix64)1 / 30;
Space.ForceUpdater.Gravity =new Vector3(0m, -9.81m, 0m);
Entity toAdd = new Box(new Vector3(0, -.5m, 0),12, 1, 12);
Space.Add(toAdd);
toAdd = new Sphere(new Vector3(-2, 16, 0), 1);
toAdd.Mass = 100;
toAdd.Gravity=new Vector3(0m, -200m, 0m);
Space.Add(toAdd);
Beta Was this translation helpful? Give feedback.
All reactions