CompoundCollisions

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

CompoundCollisions

Postby aqnuep » Tue Dec 08, 2009 4:47 pm

Hi,

I'm interested whether the following functionalities are available in the latest Newton 2.0 SDK:

1. Add a collision part to an already existing compound collision
2. Remove a collision part from an already existing compound collision
(I have found no functions in the API to do these, maybe my mistake, however I would need such thing)
3. Set the transformation of a collision part in a compound collision (relative to the compound collision center)
(It would be enough for me to do this at creation time, I don't need to modify the transformation on-the-fly)
4. Ability to identify in the collision callback that which collision part of a compound collision was hit
(As I remember sometime we discussed about this and Julio said that it's not possible, but maybe I'm wrong)

So my question is whether these are already can be done with Newton?
If not, is it possible to request these features for one of the upcoming beta versions?

Thanks in advance!
aqnuep
 
Posts: 97
Joined: Sat Dec 22, 2007 4:14 pm

Re: CompoundCollisions

Postby aqnuep » Wed Dec 09, 2009 1:44 pm

Still received no answer.

Please help me out on this, because it's heavily affects my further work.
Could you please tell anybody to me that at least this things are supported somehow by Newton now or not?
aqnuep
 
Posts: 97
Joined: Sat Dec 22, 2007 4:14 pm

Re: CompoundCollisions

Postby Julio Jerez » Wed Dec 09, 2009 2:41 pm

with the exception of removing a shape, At this time compound collision do not have any of theso abilities, It si the pay off for having the fastest querires for both line and proximities.
the scene collision does that but it have the short comming that it can only be static.

It is posible to add the AddSpahe and RemoveShape functionality to compound collision (the remove option is there but no exposed)
are you in need of that funtionality know?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CompoundCollisions

Postby aqnuep » Wed Dec 09, 2009 2:58 pm

Julio Jerez wrote:with the exception of removing a shape, At this time compound collision do not have any of theso abilities, It si the pay off for having the fastest querires for both line and proximities.
the scene collision does that but it have the short comming that it can only be static.

It is posible to add the AddSpahe and RemoveShape functionality to compound collision (the remove option is there but no exposed)
are you in need of that funtionality know?


1. Add a collision part to an already existing compound collision
This is not that important for me, just a "good to have" feature.

2. Remove a collision part from an already existing compound collision
If there is already possibility for this, then it would be nice to have it exposed in the next beta.

3. Set the transformation of a collision part in a compound collision (relative to the compound collision center)
As I see it is a performance reason behind why this is not supported?
If yes, then I understand that, however, that would probably prevent me from making the desired physics effect.
I already asked earlier if I can create fixed joints to solve the same problem, as I suspected that compound collisions cannot be put together from shapes which don't overlap at the center, however, somebody said me at the forum that I can put together totally separate shapes into a compound collision. So is that statement false?
Is there btw any way to glue together two shapes in any way?

4. Ability to identify in the collision callback that which collision part of a compound collision was hit
I understand if this thing is not available because of performance reasons, however, can you give me an advice how can I figure out in the collision callback which shape was hit?

Btw it is not that urgent for me to you to implement any of these features for the next beta. Until it will be implemented I can progress with other parts of my project. I just wanted to tell you that it would be nice to have this features, but I won't be sad if it will come out only in let's say beta 14 or something like that.

Thanks for your answer and looking forward to hear further details.
aqnuep
 
Posts: 97
Joined: Sat Dec 22, 2007 4:14 pm

Re: CompoundCollisions

Postby Stucuk » Wed Dec 09, 2009 3:01 pm

aqnuep wrote:I already asked earlier if I can create fixed joints to solve the same problem, as I suspected that compound collisions cannot be put together from shapes which don't overlap at the center, however, somebody said me at the forum that I can put together totally separate shapes into a compound collision. So is that statement false?
Is there btw any way to glue together two shapes in any way?


Two Collisions that are made into a compound collision don't have to be anywhere near each other.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: CompoundCollisions

Postby Julio Jerez » Wed Dec 09, 2009 3:22 pm

aqnuep wrote:2. Remove a collision part from an already existing compound collision
If there is already possibility for this, then it would be nice to have it exposed in the next beta.

This is easy

aqnuep wrote:1. Add a collision part to an already existing compound collision
This is not that important for me, just a "good to have" feature.

3. Set the transformation of a collision part in a compound collision (relative to the compound collision center)
As I see it is a performance reason behind why this is not supported?
If yes, then I understand that, however, that would probably prevent me from making the desired physics effect.
I already asked earlier if I can create fixed joints to solve the same problem, as I suspected that compound collisions cannot be put together from shapes which don't overlap at the center, however, somebody said me at the forum that I can put together totally separate shapes into a compound collision. So is that statement false?
Is there btw any way to glue together two shapes in any way?


If you want to make a concave shape from solid pieces, a compound collision is the fastest solution.
The only restricting of a compound collision is that the child shapes must be convex. You can add Sphere, boxes, convex hull, etc,
even convex modifiers if you want to move some shapes small distance for their initial set position.

Adding shapes to a collision tree have the problem that it makes the tree sub optimal and it must be fixed by doing a series of
tree rotations similar to what a red black tree does to maintain a tree balanced.
In the future I will add that functionality by adding a background thread that will keep doing the tree rotations in the back ground, but so far no one said they need this kind of functionality.

aqnuep wrote:4. Ability to identify in the collision callback that which collision part of a compound collision was hit
I understand if this thing is not available because of performance reasons, however, can you give me an advice how can I figure out in the collision callback which shape was hit?


There is functions that report the ID of eth collision sub shape.
If you look at function void ContactProcess (const NewtonJoint* contactJoint, dFloat timestep, int threadIndex);
in the wiki tutorial you will see how it is used. I can add a function to get the pointer to the colliding shapes,
but I do not really see what usage benefic will that provide since you can no really do much in a call back. Any action on the shape, will deiufctlly result in an umpredictable result.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CompoundCollisions

Postby aqnuep » Wed Dec 09, 2009 3:32 pm

Julio Jerez wrote:You can add Sphere, boxes, convex hull, etc, even convex modifiers if you want to move some shapes small distance for their initial set position.

It seems that's far enough for me. Just one more question about this:
You said "small distance". That's because not to have too big AABB for the collision for performance? Beside this, actually any initial position can be set as I understand. If yes, then that's great!

Julio Jerez wrote:Adding shapes to a collision tree have the problem that it makes the tree sub optimal and it must be fixed by doing a series of tree rotations similar to what a red black tree does to maintain a tree balanced.

No problem. I asked adding just for the sake of completeness if I also asked removal, however, it doesn't seems that I'll need addition btw.

Julio Jerez wrote:There is functions that report the ID of eth collision sub shape.

That seems to be enough for me to make what I want. I just need to be able to identify the collision sub shape.

Julio Jerez wrote:I do not really see what usage benefic will that provide since you can no really do much in a call back. Any action on the shape, will deiufctlly result in an umpredictable result.

I would like to process that particular shape only after NewtonUpdate, so I think I'll face no such problems that you mentioned.
I just want to be able to remove the colliding sub shape after NewtonUpdate.
aqnuep
 
Posts: 97
Joined: Sat Dec 22, 2007 4:14 pm

Re: CompoundCollisions

Postby Julio Jerez » Wed Dec 09, 2009 3:44 pm

by small distance I mean that you can wrap a collision shape into a convex modifier and add the convex modifier to the compound collision.
The compound collision will add a AABB of the shape to a spacial tree,
if you set the scale matrix of the modifier to the larger possible work space that the shape can move,
then you can move the shape by controlling the modifire matrix and as long as the shape remain inside the AABB of the tree it will not violate the compound collision queires.

if you manke the Box too big then all boxes will ovelap and the tree will become very ineficene, you can see how a collision tree can be made movable at the expense of making it less efficent.
Basially you add room to teh AABB for some small motion and each time a shape violate the limit the box is removed and re-inserts, but this is expensinve,
a more efficnet way is to see if the box voilates the box of the parent and if if does rearreange the parent, then see if if vilolate the parent parent, and keep doing it recusirvally until teh tree is satisfied.

if a box moves close to it previus position it may rotate one parent, but if a box moves from one extreme to the other extreme it may end up rotating all nodes of the tree.
any way the is how it works for the scene collision bu the scene collision is static.

you are making many good sugestions why don't you list then in place then in one thread in priority order?
that way when I am working on teh engioen I can see what peopel want most and work on teh stuff that have more change to get used.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CompoundCollisions

Postby aqnuep » Wed Dec 09, 2009 3:55 pm

Julio Jerez wrote:if you manke the Box too big then all boxes will ovelap and the tree will become very ineficene

I don't want to make very awkward compounds, just I wanted to be able to create a compound collision like e.g. the SGI logo or something like that:
Image

Julio Jerez wrote:if a box moves close to it previus position it may rotate one parent, but if a box moves from one extreme to the other extreme it may end up rotating all nodes of the tree.

I also don't want to position the sub shapes on-the-fly, just in the initialization, so that's not an issue for me.

So, as a consequence the whole stuff what I need can be done with Newton (except the shape removal, but it will be added soon), so I'm completely pleased! :)
Thanks for your help!
aqnuep
 
Posts: 97
Joined: Sat Dec 22, 2007 4:14 pm

Re: CompoundCollisions

Postby Julio Jerez » Wed Dec 09, 2009 4:10 pm

I do no see what problems you cna have doin that,
It seems to me like and array of capsules places at a fix location. just try it it should work.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: CompoundCollisions

Postby aqnuep » Wed Dec 09, 2009 4:38 pm

I supposed it should work. However, I was unsure that convex hull modifiers can be used to translate shapes.
When I've seen that in the compound collision constructor I haven't seen any offset matrix possibility, I was afraid that it won't be simple to solve this problem.

Btw I've just checked how the compound collision demo in the SDK works and I've figured out that I don't even need modifiers as I can supply offset matrices to convex collisions.
I feel embarrassed! The solution was in front of my nose, just haven't realized. Sorry for wasting your time regarding to this issue!
aqnuep
 
Posts: 97
Joined: Sat Dec 22, 2007 4:14 pm

Re: CompoundCollisions

Postby Julio Jerez » Wed Dec 09, 2009 4:44 pm

aqnuep wrote:I've just checked how the compound collision demo in the SDK works and I've figured out that I don't even need modifiers as I can supply offset matrices to convex collisions.
I feel embarrassed! The solution was in front of my nose, just haven't realized. Sorry for wasting your time regarding to this issue!

ye stha is correct all shapes have a local offset matrix, you just to used that matrix at creation time for each capsule component
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 1 guest

cron