NewtonWorldGetNextBody give only nil...

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonWorldGetNextBody give only nil...

Postby TreantBG » Tue May 08, 2012 4:05 pm

Code: Select all
Body := NewtonWorldGetFirstBody(NewtonWorld);
  while Body <> nil do begin
    ExplosionCallBack(Body,@Explosion);
    Body := NewtonWorldGetNextBody(NewtonWorld, Body);
  end;


That is my code for looping trough all the world body's.
But ExplosionCallBack is called just oce.

And the interesting thing is when i did the experiment:

Code: Select all
Body := NewtonWorldGetFirstBody(NewtonWorld);
    ExplosionCallBack(Body,@Explosion);
    Body := NewtonWorldGetNextBody(NewtonWorld, NewtonWorldGetFirstBody(NewtonWorld));
ExplosionCallBack(Body,@Explosion);
Body :=  NewtonWorldGetNextBody(NewtonWorld,NewtonWorldGetNextBody(NewtonWorld, NewtonWorldGetFirstBody(NewtonWorld)));
ExplosionCallBack(Body,@Explosion);
  end;

then it worked with no problems...
TreantBG
 
Posts: 16
Joined: Wed Apr 25, 2012 4:14 pm

Re: NewtonWorldGetNextBody give only nil...

Postby TreantBG » Wed May 09, 2012 1:42 am

How can i use NewtonWorldForEachBodyInAABBDo?
What are the second and third parameters?
Code: Select all
 const dFloat* p0 - Start AABB point
const dFloat* p1 - End AABB point
TreantBG
 
Posts: 16
Joined: Wed Apr 25, 2012 4:14 pm

Re: NewtonWorldGetNextBody give only nil...

Postby Stucuk » Wed May 09, 2012 1:45 am

They are 3 floats.

Code: Select all
type
TVec3f = Record
 X,Y,Z : Float;
end;
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: NewtonWorldGetNextBody give only nil...

Postby TreantBG » Wed May 09, 2012 2:31 am

... i know but that want what i asked...

I Ask WHAT the represent?
The body bounds (Left,Right);
The body position (X,Y,Z)

Ok listen now... i want to get the body's in radius X around point P how to do it with NewtonWorldForEachBodyInAABBDo??
TreantBG
 
Posts: 16
Joined: Wed Apr 25, 2012 4:14 pm

Re: NewtonWorldGetNextBody give only nil...

Postby Sweenie » Wed May 09, 2012 3:39 am

p0 and p1 is the min/max bounds of the AABB.

For example p0 = -100,-100,-100 & p1 = 100,100,100 which is an AABB 200 units in each axis centered around point 0, 0, 0.

Obviously this function will only return the bodies within an Axis Aligned Bounding Box but if you want to check bodies within a specific radius instead simply make the AABB bounds as large as the bounding sphere you want to check and measure the distance to each body that NewtonWorldForEachBodyInAABBDo return.
Sweenie
 
Posts: 503
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests