Questions on Newton Beta

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Questions on Newton Beta

Postby IBethune » Fri Sep 12, 2008 8:10 am

Hi all,

I just downloaded the latest beta and started porting my game code over to it, but had a few questions:

1) Are Newton 1.6, Newton 2.0, Newton Archimedia all the same thing?

2) Is there any documentation beyond the examples, as the doc directory in the NewtonSDK folder is empty?

3) Most functions I have been able to figure out what's changed, but I see the NewtonCreateTreeCollision no longer takes a callback as it's argument - what are we supposed to use instead now?

Thanks in advance for your answers.

- Iain
IBethune
 
Posts: 5
Joined: Fri Jun 03, 2005 8:57 am

Re: Questions on Newton Beta

Postby Julio Jerez » Fri Sep 12, 2008 9:02 am

1)yes
2) no at this time, there will be before the release
3)NewtonTreeCollisionSetUserRayCastCallback (const NewtonCollision* treeCollision, NewtonCollisionTreeRayCastCallback rayHitCallback)
NewtonStaticCollisionSetDebugCallback (const NewtonCollision* staticCollision, NewtonTreeCollisionCallback userCallback);
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Questions on Newton Beta

Postby IBethune » Fri Sep 12, 2008 10:20 am

I'm still a little unsure about my third questions, since the Newton.h file says:

Code: Select all
// collision tree call back (obsoleted no recommended)


Basically what I am trying to achieve is that when an explosion occurs, I get all the polygons within the radius of the explosion and then draw an explosion decal using the position data of those polygons.

What I was doing before we relying on the fact that the TreeCollisionCallback would be called between the Begin and End collision callbacks, but since there's no End Callback any more this approach won't work.

So either I need a way of getting all polygons from a TreeCollision that collide? Or at least all the polygons that intersect the AABB?

Any ideas?

Cheers

- Iain
IBethune
 
Posts: 5
Joined: Fri Jun 03, 2005 8:57 am

Re: Questions on Newton Beta

Postby Julio Jerez » Fri Sep 12, 2008 12:58 pm

those are material callbacks you are talking about.
the contct prossess is noe more flexible and you can do teh check you are talking about. with out problems,
plus you can also use the function for all bodies in AABB to dind put out the object in teh explosion. and for all faces in AABB fo teh collsion tree.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Questions on Newton Beta

Postby IBethune » Sat Sep 13, 2008 2:50 pm

So I set up a collision callback for my explosion object, then in contact process callback I use:

Code: Select all
int NewtonTreeCollisionGetVertexListIndexListInAABB (const NewtonCollision* treeCollision, const dFloat* p0, const dFloat* p1, const dFloat** vertexArray, int* vertexCount, int* vertexStrideInBytes, const int* indexList, int maxIndexCount, const int* faceAttribute);


Can you describe how I figure out which vertices in the vertexArray belong to which polygons? I assume this is something to do with the indexList, but don't know how it works...
IBethune
 
Posts: 5
Joined: Fri Jun 03, 2005 8:57 am

Re: Questions on Newton Beta

Postby IBethune » Tue Sep 16, 2008 4:37 pm

Can you also tell me with this function which of the arguments are output from the function and what they all mean?

Do I need to allocate any of the arrays to receive data into? An example of using this function would be really helpful...

Thanks

- Iain
IBethune
 
Posts: 5
Joined: Fri Jun 03, 2005 8:57 am

Re: Questions on Newton Beta

Postby Julio Jerez » Tue Sep 16, 2008 9:49 pm

the is a comneted out sampel in eth teh lie levele primitive

int xxx;
dVector p0(-100, -100, -100); // the min and max of to searh
dVector p1(100, 100, 100);
const dFloat* vertexArray; // the peoeinetet to eth vertex list set bu the call
int vertexStrideInBytes; // the stride o feact point set by the function
int vertexCount; //thevertex count set by the l
int indexList[256]; //the index list set by teh funtion
int attributeList[256/3]; // the atribute list ste by the call
xxx = NewtonTreeCollisionGetVertexListIndexListInAABB (collision, &p0[0], &p1[0], &vertexArray, &vertexCount, &vertexStrideInBytes, indexList, sizeof (indexList)/sizeof (indexList[0]), attributeList);


basically you can make a collision tree of your viual mesh and whe ethe explosion happens you can call the function and get the faces in the collision aabb.
if you do not optimize the mesh then the indices returned by the call will be the same relative indices into you vslua mesh.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Questions on Newton Beta

Postby IBethune » Wed Sep 17, 2008 5:38 pm

Thanks Julio - got it working now!
IBethune
 
Posts: 5
Joined: Fri Jun 03, 2005 8:57 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests