Force-field

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Force-field

Postby collerblade » Sun Apr 24, 2016 1:27 pm

Hello Julio

I want to imple ment efficent force-fields (mutliple types). My question is: "How to find the bodies in an area"?? I found 2 solutions:
1. Add a listener with NewtonWorldAddPreListener(...) than in the callback find the bodies with NewtonWorldForEachBodyInAABBDo(..)
2. Should i use kinematic bodies??

With one is the preferred way (for faster performance)?

Bonus question:
if the forcefield destroyed, how to remove the listener added by NewtonWorldAddPreListener. Did i miss some api??

TY collerblade
collerblade
 
Posts: 88
Joined: Mon Apr 05, 2010 12:09 pm

Re: Force-field

Postby Julio Jerez » Sun Apr 24, 2016 1:35 pm

check out the trigger manager. the simpler demo of a force field would be:
../demosSandbox\sdkDemos\demos\ArchimedesBuoyancy.cpp
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Force-field

Postby collerblade » Mon Apr 25, 2016 4:38 am

y i saw the demo. It uses a kinematic body. It is good if the forcfield area doesnt change. But what happens if the area changes frequently? Or i the area is infinite? NewtonWorldForEachBodyInAABBDo is easier to use.

Bonus question still stands. Is there any way to remove callbacks added by NewtonWorldAddPreListener?

Bonus question2:
What is the second callback in NewtonWorldAddPreListener does? It gets called before the world destruction?

Thanks
collerblade
 
Posts: 88
Joined: Mon Apr 05, 2010 12:09 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron