Ticket #37 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

Physics is not updating real time

Reported by: mike Owned by: mike
Priority: normal Milestone: alpha-test
Component: mv3d Version: 0.1-alpha
Keywords: Cc:
Estimated Effort: 1 day Platform: All
State: Relative Size:

Description

Problem

Objects seem to move slowly because step is called 20x/second with a value of 0.01. It should instead be called 100x/second with that same value. The problem comes from areas combining their collision detection (which needs to happen each time step is called) with updating objects.

Change History

Changed 6 years ago by mike

  • status changed from new to closed
  • resolution set to fixed

Solution

So far, just calling realm's step 5x more often. That seems to not cause any problems, but it's something that should be watched-- especially with fast moving objects as they may tunnel through other objects.

Changed 6 years ago by mike

  • status changed from closed to reopened
  • platform set to All
  • resolution fixed deleted

Problem

(reopening) With the realm calling step 5x for each collision detection attempt, the collisions aren't working very well.

Changed 6 years ago by mike

Solution 2

Made odeRealms keep track of the areas in them and run their collide function every time they do a step as should be done. This will also make it easier to add collision detection between adjacent areas.

This still needs to be tested, so I will leave it open. Unit tests work though.

Changed 6 years ago by mike

  • status changed from reopened to closed
  • resolution set to fixed

There was some major jumpiness, so I did a lot of tweaking. A future enhancement should be to make all the numbers I've tweaked parameters. Right now, physics steps and collides 10x per iteration and does each step for 0.005 seconds. So it is a little faster than real time, but it looks perfect and things work great. The player even bends his knees when he lands and can walk up slopes, stairs, etc. I was jumping from cube to cube and pushing cubes around with no problems. I think the key was the smaller update (0.005s vs 0.01s). Don't mess with the values! :)

Note: See TracTickets for help on using tickets.