Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

variable timestep and car physics #12

Open
David-Luis opened this issue Mar 13, 2013 · 6 comments
Open

variable timestep and car physics #12

David-Luis opened this issue Mar 13, 2013 · 6 comments

Comments

@David-Luis
Copy link

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
Copy link
Member

muzerly commented Mar 13, 2013

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

@David-Luis
Copy link
Author

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
Copy link
Member

muzerly commented Mar 13, 2013

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

@David-Luis
Copy link
Author

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
Copy link

lo-th commented Mar 13, 2013

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 [email protected] 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//issues/12#issuecomment-14837847
.

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

@David-Luis
Copy link
Author

ok, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants