away3d / awayphysics-core-fp11

Away Physics - 3D physics library for the Away3D Engine in Flash Player 11
http://www.awayphysics.com
112 stars 47 forks source link

variable timestep and car physics #12

Open David-Luis opened 11 years ago

David-Luis commented 11 years ago

There is a bug that make the wheels and the car body make strange movements when use a variable delta time.

Here is a demo: (takes a few seconds to load) https://dl.dropbox.com/u/28132609/demo_car_away/index.html

Use arrows to control the car. You can see the bug when the car is turning.

Best regards

muzerly commented 11 years ago

How you set the time step? it's must small enough make the simulation precise.

David-Luis commented 11 years ago

I use this code: _physicsWorld.step(elapsedTime, maxSubStepsPhysics, _timeStep);

where:

maxSubStepsPhysics:int = 3 _timeStep:Number = 1/60 elapsedTime = varies between 1/30 - 1/60 (I updated the demo, to make sure the value is between this values, you have to clear the browser cache)

I'm using Away3D 4.1 and AwayPhysics v1.0 alpha (13-11-2012)

muzerly commented 11 years ago

not sure what cause this, you can try to adjust some property of AWPWheelInfo, like damping, friction etc.

David-Luis commented 11 years ago

The problem is not on that values, is the use of variable step. If I use fixed step, the problem doesn't appear:

_physicsWorld.step(_timeStep, 1, _timeStep);

where: _timeStep = 1/60

You can see it in this demo: https://dl.dropbox.com/u/28132609/demo_car_away_fixed/index.html

lo-th commented 11 years ago

you find solution in this thread http://away3d.com/forum/viewthread/4014/

in AwayPhysics.c line 944 vehicle->updateWheelTransform(j,true); change to false and rebuild swc with flascc

On Wed, Mar 13, 2013 at 1:16 PM, louis87 notifications@github.com wrote:

The problem is not on that value, is the use of variable stop. If I use fixed step, the problem doesn't appear:

_physicsWorld.step(_timeStep, 1, _timeStep);

where: _timeStep = 1/60

You can see it in this demo: https://dl.dropbox.com/u/28132609/demo_car_away_fixed/index.html

— Reply to this email directly or view it on GitHubhttps://github.com/away3d/awayphysics-core-fp11/issues/12#issuecomment-14837847 .

LoTh - Freelance flash as3 / 3D website http://perso.numericable.fr/chamaslot/ | bloghttp://3dflashlo.wordpress.com

David-Luis commented 11 years ago

ok, thanks!