Physics.Simulate ignores joints????

I am trying to use Physics.Simulate to see where a ball on a rope will end up. The ball is connected to a chain of several joints and in real time it looks great. But when I call physics.simulate, the ball just drops like a rock every time. How do I include the joint forces into the physics simulation???

No. It’s the same call that Unity calls when it’s called automatically; not a special code-path for you.

You’re doing something wrong here if that’s happening. Might be that you’re just passing in a huge time expecting it to somehow integrate that time which won’t work. No idea.

I have tried very small amounts of time like .1 seconds. The joints are never taken into account during the simulation. The links and ball all start falling straight down and hit the floor. Then turning normal simulation back on they go crazy and snap back to where they where as the joints pull everything back together

Extra info: This is a 3d scene, not a 2d scene

That’s a ver large time. By default Unity calls Physics.Simulate 50 times per second with time = 0.02 seconds.

Edit: note that each call to Physics.Simulate simulates 1 “tick” of the physics. So in order to execute the physics simulation you must call it multiple times each second, as described above. Maybe you’re just calling Physics.Simulate once, or too few times? Try calling Physics.Simulate(0.02f) from FixedUpdate.

1 Like

As above, you’re doing joint simulation at 1/0.1 = 10Hz which is a very low frequency or in other words, to physics, large steps of time. 0.1 sec is a small amount of time to you but for physics calculations, it’s at least 5x too much.

The default Unity time-step is 50Hz (1/50), see Fixed Timestep in the Time Manager.

This wouldn’t make a difference. 2D physics wouldn’t like this either. :slight_smile: