NewtonCreateConvexHull and OffsetMatrix

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonCreateConvexHull and OffsetMatrix

Postby JulBaxter » Mon May 17, 2010 10:11 am

Is it for optimization purpose that OffsetMatrix is baked in NewtonCollision ?

Because NewtonCollision can be shared between NewtonBody, IMO it would be more flexible and powerful for end-users to set offestMatrix during NewtonCreateBody. Like that, the same NewtonCollision could be setup in different ways with each NewtonBody using it.

What do you think about that ?
JulBaxter
 
Posts: 23
Joined: Wed Mar 10, 2010 6:56 am

Re: NewtonCreateConvexHull and OffsetMatrix

Postby Julio Jerez » Mon May 17, 2010 10:32 am

That would be cool and I realized that it is a problem for some featores, but for Newton 2.0 that woudl be a too big of a job.

Now the offset matrix of a collision shape is part of the signature of the shape and that make it difficult to change it.

In fact there is a colilsion instance already that I used with the destruction shape but it is not exposed.
I found that problem when I realised that the collision shape need to store local data with the shape which that make sharing impossible.
on the other hand adding collision instance can be a big change that need a from the ground up refactoring, given the large number of shape there are in the engine.
Maybe for newton 3.0

Collision instance will be a generalization of the convex hull modifirer, that already exist in the enigne.
you can use that shape for what you want. and the use the matrix to relocate the shape.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateConvexHull and OffsetMatrix

Postby JulBaxter » Mon May 17, 2010 11:42 am

Do you want to say I can create NewtonCollisions with a NULL OffsetMatrix and then share it by creating ConvexHullModifier ? (i.e. different ConvexHullModofiers can reference the same NewtonCollision ? )

Does A = NewtonCreateConvexHullModifier( B ) increase the reference counter of B ?
Have I to call NewtonReleaseCollision on A ?

and finally what are the consequences to generalize the use of ConvexHullModifier for each Shape I put in a Body in term of memory charge and runtime performance ?
JulBaxter
 
Posts: 23
Joined: Wed Mar 10, 2010 6:56 am

Re: NewtonCreateConvexHull and OffsetMatrix

Postby Julio Jerez » Mon May 17, 2010 1:14 pm

to use the modifier you make a collision, and the you can make as many modifier that use tha colliion as you want.

The consecunce of using a modifires is that it is a tow level of indirection, plus bacuase the matrix is a Ganeral matrix, it must use genral matrix for Invertiosn, and rotation,
some of the functional like Raycastinf cost a litle more because of the general matrix.
The cost is marginal, you cna use it for what you want.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCreateConvexHull and OffsetMatrix

Postby JulBaxter » Tue May 18, 2010 2:13 am

Thank you for your answers.
JulBaxter
 
Posts: 23
Joined: Wed Mar 10, 2010 6:56 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron