Jump to content

Recommended Posts

Posted

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
Posted

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?

Posted

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

  • Thanks 1

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

Posted

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?

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

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.

×
×
  • Create New...