Jump to content

UpdatePhysics()


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

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?

Link to comment
Share on other sites

  • Solution
  • 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

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

 Share

×
×
  • Create New...