SpiderPig Posted May 19, 2019 Posted May 19, 2019 I would love to be able to use newton commands directly, such as NewtonWorldRayCast(). Is there a way to get the newton world from within Leadwerks? Quote
Ma-Shell Posted May 19, 2019 Posted May 19, 2019 You can see in the file "Leadwerks\Include\Classes\Drivers\Physics\NewtonDynamics\NewtonDynamicsPhysicsDriver.h", that the PhysicsDriver has a reference to the collisionWorld, which is a NewtonWorld pointer. You can get the current physics-driver from "_currentPhysicsDriver" but you need to cast it to a NewtonDynamicsPhysicsDriver, thus: ((NewtonDynamicsPhysicsDriver*)(_currentPhysicsDriver))->collisionWorld should be the droid you're looking for. (I haven't tested this but I am fairly certain, this will work) 1 Quote
SpiderPig Posted May 19, 2019 Author Posted May 19, 2019 Awsome! I spent ages looking through those files I'm surprised I missed it. Thanks heaps! Quote
SpiderPig Posted June 12, 2019 Author Posted June 12, 2019 Quote ((NewtonDynamicsPhysicsDriver*)(_currentPhysicsDriver))->collisionWorld Thought I'd update this here too, the above code doesn't get the correct newton world. The code below does; NewtonWorld* GetNewtonWorld() { auto _world = World::GetCurrent(); auto _simulation = (NewtonDynamicsSimulation*)_world->simulation; return _simulation->newtonworld; } Quote
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.