NewtonMaterialSetCollisionCallback Query

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonMaterialSetCollisionCallback Query

Postby Stucuk » Fri Sep 25, 2009 3:08 am

With 2.0 do you still have to do the following for materials to generate callbacks in every instance? (With 1.53 iirc you had to do it 2 times, or you would only get a callback when Material 1 hit Material 2 but not the other way around)

NewtonMaterialSetCollisionCallback (World, Material1, Material2...);
NewtonMaterialSetCollisionCallback (World, Material2, Material1...);
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: NewtonMaterialSetCollisionCallback Query

Postby Julio Jerez » Fri Sep 25, 2009 8:12 am

if yo ulook at teh tutorial advanced material in the wiki, there is an altenate solution that is much simpler and user friendly , and it is completely implemented on the end user side.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonMaterialSetCollisionCallback Query

Postby Stucuk » Fri Sep 25, 2009 5:58 pm

From what i can tell that should only work on tree collisions(as they are the only ones to have Collision Attrib parameters). I don't see how you can work out what "Fake" material a face would have on non tree collision objects.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: NewtonMaterialSetCollisionCallback Query

Postby Julio Jerez » Fri Sep 25, 2009 6:26 pm

all shapes have IDs for using then as submaterils. It is a funtionality of 2.0x

Check the tutorial please, I use it in the Advance Material tutorial,

if you undesrnad teh tutorial you xcan forget about doing this in many material, just use the default and everything else you can control
NewtonMaterialSetCollisionCallback (World, Material1, Material2...);
NewtonMaterialSetCollisionCallback (World, Material2, Material1...);
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonMaterialSetCollisionCallback Query

Postby Stucuk » Fri Sep 25, 2009 6:40 pm

Check the tutorial please, I use it in the Advance Material tutorial,

I did.

Select project Tutorial_201_AbvanceMaterial as Startup project in visual studio

I can't see any tutorial demos(as in ones other than the "normal" all in one example) in the SDK (2.09), so i can't see how your setting up the objects. So NewtonMaterialGetBodyCollisionID returns the ShapeID ? if so would be better if it was called NewtonMaterialGetBodyShapeID .
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: NewtonMaterialSetCollisionCallback Query

Postby Julio Jerez » Fri Sep 25, 2009 6:57 pm

Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonMaterialSetCollisionCallback Query

Postby Stucuk » Fri Sep 25, 2009 7:01 pm

As i have stated, i have been to the tutorial you wrote quite a few times now. There is no information on how you setup the objects, so its hard for me to get a clear picture of how everything works when i can't see everything thats going on (I.E How you are creating the objects). There is nothing on the tutorial that shows how you are setting the "fake" material of the object so you can later get it back in the callback.

There is no Visual Studio tutorial projects in the SDK like the tutorial suggests looking at(Unless im blind).

The tutorial seems to suggest at the bottom that i may be right with "So NewtonMaterialGetBodyCollisionID returns the ShapeID ?", but your link to the tutorial would suggest im wrong. So im confused.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: NewtonMaterialSetCollisionCallback Query

Postby Julio Jerez » Fri Sep 25, 2009 7:39 pm

Are you reading it only or did you dwoloand teh project
http://www.newtondynamics.com/downloads/NewtonTutorials.rar

The archive comes with all the tutorial and it is incremental, that tutorial asume you already know teh serie 100 tutorial whic are teh basic setting of things.
Please tell me if you have found the VS project. It is not in the demos that comes with the SDK, in in in teh Tutorial archive.


in theis lines

Code: Select all
   id0 = NewtonMaterialGetBodyCollisionID (material, body0);
         if (id0 == 0) {
            id0   = NewtonMaterialGetContactFaceAttribute (material);
         }
         id1 = NewtonMaterialGetBodyCollisionID (material, body1);
         if (id1 == 0) {
            id1   = NewtonMaterialGetContactFaceAttribute (material);
         }



what the demo does is that is uses teh ID 0 as an indicator that teh shape ID must be read from a face.
In Netwon when a contact is craated teh shapen is place in teh material, however Collsiion trees and user polygonl sopu cna no make a shape for each face becuase it will be to tieme
consuming intead is copy the id of the Sub Shape.
Regular shape do no have subshpe, but collision tree and compound do.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonMaterialSetCollisionCallback Query

Postby Stucuk » Fri Sep 25, 2009 10:34 pm

Julio Jerez wrote:Are you reading it only or did you dwoloand teh project
http://www.newtondynamics.com/downloads/NewtonTutorials.rar


I had only read it. Just looked at the wiki main tutorial page and found the download(I never read tutorial list pages, i just click on the actual tutorials). It would be nice if the tutorials came with the SDK. Thanks for the link.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron