Scaling A Compound Collision Body

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Scaling A Compound Collision Body

Postby Bird » Fri Sep 06, 2013 6:31 pm

Julio Jerez wrote:on the assert can you show print the values of the vector. when the assert happens?
ans also the value of the matrix when you call the function.
AdvancedPlacement090_64d.dll!NewtonBodySetMatrix(const NewtonBody * const bodyPtr, const float * const matrixPtr)

that lead to the crash.


To make it simpler, I made another scene with a centered box, so the the matrix passed to NewtonBodySetMatrix is the Identity matrix ... although I noticed some of the zeros are negative for some reason

2013-09-06 22:27:52.175 [Log:0:] D:
[ 1, -0, 0, 0;
0, 1, 0, 0;
-0, 0, 1, 0;
0, 0, 0, 1]

There some NAN when I look at the values at the assert

adjust {m_type={...} m_typeInt={...} m_f=0x0000000000139cf0 ...} dgVector
+ m_type {0, 0, -1.#QNAN, 0} __m128
+ m_typeInt {000000000000000000ffffffff00000000} __m128i
- m_f 0x0000000000139cf0 float [4]
[0] 0.00000000 float
[1] -1.#QNAN00 float
[2] 0.00000000 float
[3] 0.00000000 float
m_x 0.00000000 float
m_y -1.#QNAN00 float
m_z 0.00000000 float
m_w 0.00000000 float
m_ix 0.00000000 float
m_iy -1.#QNAN00 float
m_iz 0.00000000 float
m_iw 0.00000000 float

- m_f 0x0000000000139cb0 float [4]
[0] 5507304.0 float
[1] 38.000000 float
[2] 3212596.0 float
[3] 1.0000000 float

- ret.m_f 0x0000000000139cb0 float [4]
[0] 5507304.0 float
[1] 38.000000 float
[2] 3212596.0 float
[3] 1.0000000 float

Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Scaling A Compound Collision Body

Postby Bird » Fri Sep 06, 2013 6:35 pm

Now the function that is checked in has a bug that I just fixed, you need to update so that that change take effect.
please try that and let us see where we are.


I resynced tried with NewtonBodySetCollisionScale and there's still penetration problems after scaling. The behavior is slightly different but there are still problems I'm using NewtonMeshApproximateConvexDecomposition to make the compound shape if that makes a difference.


-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Scaling A Compound Collision Body

Postby Julio Jerez » Fri Sep 06, 2013 7:07 pm

Not I do not think is reletae to the decomposition. soem hwo teh value are becoming large some where.

when you move the bodies, you are just setting the transform matrix?
my guess is that some how soem large penetration is generation some large acceleration.
but I do not see why it only shows wih the shape is scaled.
that can be fix by usin a better move funtion, basically oen the change the matrix and the velocity,
I can help you with but let us see why is casing the crash.


so you have a way to show the AABB at iteratove time?

can you send me the serialized scene? I will try to recreate what you are doing in the demos.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling A Compound Collision Body

Postby Julio Jerez » Sat Sep 07, 2013 7:19 am

One more question, are you scaling the body outside of for a game loop?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling A Compound Collision Body

Postby Julio Jerez » Sat Sep 07, 2013 11:41 am

I also replaced the floor function wit this
DG_INLINE dgVector Floor () const
{
// dgVector mask ((dgFloat32 (1.5f) * dgFloat32 (1<<23)));
// dgVector ret (_mm_sub_ps(_mm_add_ps(m_type, mask.m_type), mask.m_type));
// dgVector adjust (_mm_cmplt_ps (m_type, ret.m_type));
// ret = _mm_sub_ps (ret.m_type, _mm_and_ps(_mm_set_ps1(1.0), adjust.m_type));

dgVector truncated (_mm_cvtepi32_ps (_mm_cvttps_epi32 (m_type)));
dgVector ret (truncated - (dgVector::m_one & (*this < truncated)));
dgAssert (ret.m_f[0] == dgFloor(m_f[0]));
dgAssert (ret.m_f[1] == dgFloor(m_f[1]));
dgAssert (ret.m_f[2] == dgFloor(m_f[2]));
dgAssert (ret.m_f[3] == dgFloor(m_f[3]));
return ret;
}


It may be that I had a bug in the function itself, please try again.
if it fail, can you give the file so that I can test with the same model you are testing

I hack the demo to stake the compound a run time each time I pick a body, and I can no make the crash happens.
Maybe trying will the same mesh
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling A Compound Collision Body

Postby Bird » Sat Sep 07, 2013 12:44 pm

Julio Jerez wrote:One more question, are you scaling the body outside of for a game loop?


The engine is not running when the crash occurs. Here's another video using today's latest sync. I'm just scaling a box that whose transform matrix is the identity matrix ... that never changes. The value of the scale when the crash occurs is ( 2.222, 2.222, 2.222 )

http://hurleyworks.com/media/flash/CompoundScaleCrash/CompoundScaleCrash.html

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Scaling A Compound Collision Body

Postby Julio Jerez » Sat Sep 07, 2013 1:36 pm

To make It clear, are you running a loop that is simple scaling a compound collision, with no physic update is happing during the scaling?
is that what you are doing when the crash happens?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling A Compound Collision Body

Postby Julio Jerez » Sat Sep 07, 2013 1:49 pm

Oh, I got it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling A Compound Collision Body

Postby Julio Jerez » Sat Sep 07, 2013 2:29 pm

al right, I think I have it fixed now.
Please try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling A Compound Collision Body

Postby Bird » Sat Sep 07, 2013 2:45 pm

Julio Jerez wrote:al right, I think I have it fixed now.
Please try again.


Excellent! No crashing and uniform compound scaling seems to be working perfectly

Thanks!

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Scaling A Compound Collision Body

Postby Julio Jerez » Sat Sep 07, 2013 2:50 pm

I was working on the non uniform scale for compound collisions.

But I realize that that would require to add an extra matrix to the collision instance, and make a change every where the matrix are used.
also many function prototype has to change to take that extra matrix as argument
I do no like that idea of making the collision intact so big

if the Scale is uniform that matrix happen to be identity. it is also identity for many nor uniform scaling, but unfortunately is not always guarantee to be identity

so I am incline that for Newton 300, we only support uniform scale on compound collision.

what do you think, are you guys using non uniform scale of compound shapes?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling A Compound Collision Body

Postby Bird » Sat Sep 07, 2013 3:05 pm

what do you think, are you guys using non uniform scale of compound shapes?

It would be ok with me not to have non uniform scaling of compounds, if it's too big a deal for you. LW users always have the option to scale the mesh in Modeler before bringing into Layout so it would be just a minor inconvenience to them.

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: Scaling A Compound Collision Body

Postby Julio Jerez » Sat Sep 07, 2013 3:11 pm

I will give one more change, but of the extra matrix can not be concatenated for the run time calculation of contacts, I will put on hold for some other version.
It will be fine to take a small hit for raycast, but not for contacts calculation. specially when compound are meant to have unlimited number of sub shapes.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Scaling A Compound Collision Body

Postby JoeJ » Sat Sep 07, 2013 3:23 pm

I'd also say nonuniform compound is not necessary.
I think it is not worth adding complexity which is hard to maintain afterwards - may slow you down for a feature that would be used very rarely.

Same for the skewing discussion. I do not think that revolutionary gaming ideas would profit from those things.
Scaling can be cool - i remember that video here from the portal alike engine, where an object went half through a portal,
and the other half came out downscaled from another portal.
That's awesome, but regular scaling is enough for it and even this was not yet used in a real game.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Scaling A Compound Collision Body

Postby Leadwerks » Sat Sep 07, 2013 11:47 pm

It should either be supported 100% or not at all. The worst is if it works in some situations, but doesn't in others.

Why would anyone need non-uniform scaling? Here's a common usage: rocks.

You tell my users why they can't use a non-uniform scaling. This is the #1 complaint I got about physics in Leadwerks 2.

I had to bypass Newton's scaling and implement my own technique since it is presently incomplete.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 7 guests