Jump to content
  • 0
Lethal Raptor Games

UpdatePhysics()

Question

After looking through the Newton SDK I saw a couple of hooks; PreUpdate() and PostUpdate() and I was wondering at what point is the UpdatePhysics() hook called?  Is it before or after physics has been calculated / applied?

  • Confused 1

Share this post


Link to post

5 answers to this question

Recommended Posts

  • 0
  • PreUpdate()
  • NewtonUpdate()
  • PostUpdate()

The collision world is an extra world for storing collision objects in. The World class has a Simulation object that can be cast to a NewtonDynamicsSimulation object, which contains a member for the Newton world.

  • Thanks 1

Share this post


Link to post
  • 0

So once again I am attempting to break things - @Josh I have question for you... I am using Newton functions to add a PreUpdate callback to the newton world but the callbacks are not being called unless I call NewtonUpdate myself, is World::Update() not calling NewtonUpdate?

Share this post


Link to post
  • 0

World::Update only calls NewtonUpdate when enough time has passed for a physics update to be needed.

  • Thanks 1

Share this post


Link to post
  • 0

Thank you!  That answer led me to finding the problem.  This is how I was getting the NewtonWorld;

NewtonWorld* GetNewtonWorld()
{
	return ((NewtonDynamicsPhysicsDriver*)NewtonDynamicsPhysicsDriver::GetCurrent())->collisionWorld;
}

Which worked for a lot of things but it didn't match when I got the world like this;

Model* bn = Model::Box();
mdl->SetShape(Shape::Box());
auto body = ((NewtonDynamicsBody*)mdl->body)->body;

MainFrame::newtonWorld = NewtonBodyGetWorld(body);

With the later the callbacks worked!

 

Quote

After looking through the Newton SDK I saw a couple of hooks; PreUpdate() and PostUpdate() and I was wondering at what point is the UpdatePhysics() hook called?  Is it before or after physics has been calculated / applied?

I take it then this is a callback in UpdateWorld()?  Updating the physics when the timing is correct?

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...