SpiderPig Posted June 11, 2019 Posted June 11, 2019 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? 1 Quote
SpiderPig Posted June 12, 2019 Author Posted June 12, 2019 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? Quote
Josh Posted June 12, 2019 Posted June 12, 2019 World::Update only calls NewtonUpdate when enough time has passed for a physics update to be needed. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
SpiderPig Posted June 12, 2019 Author Posted June 12, 2019 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? Quote
Solution Josh Posted June 12, 2019 Solution Posted June 12, 2019 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. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
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.