Recursive CompoundCollision

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Recursive CompoundCollision

Postby Carli » Fri Oct 23, 2009 2:23 am

Hi,
i want to include newton into my game engine and the script has a lot of possibilities to manipulate the physics. everyone should be able to make his own scripts and i heard that you cannot make recursive compound collisions. this would make it harder to combine some collisions (for example three cylindres are a wheel axis and a box and two wheel axis are a car)

maybe you could make a workaround that copies the content of nested compoundcollisions into a generated compound.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Recursive CompoundCollision

Postby JernejL » Fri Oct 23, 2009 3:36 am

Carli wrote:Hi,
i want to include newton into my game engine and the script has a lot of possibilities to manipulate the physics. everyone should be able to make his own scripts and i heard that you cannot make recursive compound collisions. this would make it harder to combine some collisions (for example three cylindres are a wheel axis and a box and two wheel axis are a car)

maybe you could make a workaround that copies the content of nested compoundcollisions into a generated compound.


Are you making a game? because using such detailed collisions for a game is totally unneccesary and will just waste cpu power.

You can replicate and combine compounds manually - you can call getinfo on it to get a pointer to all compound parts, and then get the matrix for each piece, transform and combine into a new one.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Recursive CompoundCollision

Postby Carli » Fri Oct 23, 2009 7:52 am

but i want to do it naive. the createcompoundcollision should work no matter what the collision is - because i don't know it.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Recursive CompoundCollision

Postby JernejL » Fri Oct 23, 2009 8:42 am

Carli wrote:but i want to do it naive. the createcompoundcollision should work no matter what the collision is - because i don't know it.


Newtoncollisiongetinfo can tell you what type the collision is.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Recursive CompoundCollision

Postby Julio Jerez » Fri Oct 23, 2009 1:20 pm

you are right teh collision coudl work no mattert what, however thsi si s a real time application no a modeling package.
When writing real time code you nee to take shouldcuts, making teh collsion recursive implie a recursve inteface on the base call of the collision and will slow down all other collision shapes.

Like Delfi say you can get the compounds you want and put then togeteh in a new compound, why is this a problem?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Recursive CompoundCollision

Postby Carli » Fri Oct 23, 2009 3:17 pm

1. Because it would be easier to be implemented in NewtonCreateCompundCollision.
2. you cannot make faults with combining collisions to one new collision.
3. when i implement the collision combination by myself, no one of the others could use it.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Recursive CompoundCollision

Postby JernejL » Sat Oct 24, 2009 6:55 am

Carli wrote:1. Because it would be easier to be implemented in NewtonCreateCompundCollision.
2. you cannot make faults with combining collisions to one new collision.
3. when i implement the collision combination by myself, no one of the others could use it.


1. As julio said, you'll get a speed benefit if you add the old compound's pieces instead of the whole compound
2. Everyone can make faults..
3. We won't stop you from posting the code here if you wish to share it ;)
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Recursive CompoundCollision

Postby Carli » Sun Oct 25, 2009 2:10 pm

1. my idea is to have an engine-site merging (putting all pieces of the compounds into the new compound)
2. and i have to tell all plugin writers: "don't make a compound collision of compound collisions"?

4. it's the most intiutive way that you can "nest" compounds (in reallity there will be a merging like i said in 1.)
5. you can write opengl-like interfaces with "AddCollision"...
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Recursive CompoundCollision

Postby JernejL » Sun Oct 25, 2009 2:19 pm

Carli wrote:1. my idea is to have an engine-site merging (putting all pieces of the compounds into the new compound)
2. and i have to tell all plugin writers: "don't make a compound collision of compound collisions"?

4. it's the most intiutive way that you can "nest" compounds (in reallity there will be a merging like i said in 1.)
5. you can write opengl-like interfaces with "AddCollision"...


1,2,3,4: You can make compound collision, just not compound collisions using compound pieces.. since that defeats the purpose of compound collision and is much less efficient.
5: why would you want to do that? what's wrong with current method?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Recursive CompoundCollision

Postby Julio Jerez » Thu Nov 05, 2009 3:27 pm

Carli wrote:Hi,
i want to include newton into my game engine and the script has a lot of possibilities to manipulate the physics. everyone should be able to make his own scripts and i heard that you cannot make recursive compound collisions. this would make it harder to combine some collisions (for example three cylindres are a wheel axis and a box and two wheel axis are a car)

maybe you could make a workaround that copies the content of nested compoundcollisions into a generated compound.


I thon I got you point now, believe that maybe a pair of function for adding and removing Shape to a compound collision will do what you want.
I have RemoveCollisonShape I need to think of the add shape part.
But now that compound Collision are very powerful in Newton,
you can make entyre levels with them, Maybe and inteface to add and remove shape will be good, because it will make more flexible to use.

I will add that for 2.11, since I get to a point when I need it, so I will expose the funtionality.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Recursive CompoundCollision

Postby Carli » Thu Nov 05, 2009 4:22 pm

the main problem was that the object of the datatype "NewtonCollision" is not the same like a "NewtonCollision", that means, you can create a CompoundCollision of a set of "NewtonCollision" that returns a "NewtonCollision" but you are not allowed to encapsulate a "NewtonCollision" when it's a Compound Collision.

- and that's not that thing you expect from an abstract Datatype
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Recursive CompoundCollision

Postby Julio Jerez » Thu Nov 05, 2009 6:07 pm

you need to use GetInfo to find out the type of a collision.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests