buoyancy and scaled collisions

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 4:26 am

I 'm not sure if scaling issue on compound was working correctly before, since it works the first time.
I'll try to make it in a sample this weekend.

even when the body is correct for me the object sink :/ did you tried with a scale < 1.0 ?

>> about the compound scaling issue, the collisions shapes seems correct but the offset matrix of each shape seem to be 0. this make sens in your code you set m_localMatrix from the previous m_localMatrix matrix state. when you should keep the initial matrix somewhere and use it in scale functions I think.
m_localMatrix = m_aligmentMatrix * m_localMatrix;
m_aligmentMatrix = m_aligmentMatrix.Transpose();
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: buoyancy and scaled collisions

Postby Julio Jerez » Fri Nov 28, 2014 8:41 am

Ok I did find the bug that made the application of a scale to a compound to malfunction.

but the plane buoyancy should work, sync again and try, and is if is still not working make the test because I do not know what is wrong them
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 9:33 am

wow really strange still all the same.
the new scale on compound still bad :/
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: buoyancy and scaled collisions

Postby Julio Jerez » Fri Nov 28, 2014 9:34 am

I do not know what that is them, when I test here it seems to work, can you make a test demo?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 9:35 am

yes I will
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 12:52 pm

To simply reproduce the scale issue :

change in CreateConvexAproximation of the ConvexAproximation demo

Code: Select all
   dMatrix matrix (dGetIdentityMatrix());
   matrix.m_posit = origin;
   for (int ix = 0; ix < instaceCount; ix ++) {
      for (int iz = 0; iz < instaceCount; iz ++) {
         dFloat y = origin.m_y;
         dFloat x = origin.m_x + (ix - instaceCount/2) * 10.0f;
         dFloat z = origin.m_z + (iz - instaceCount/2) * 10.0f;
         matrix.m_posit = FindFloor (world, dVector (x, y + 10.0f, z, 0.0f), 20.0f); ;
         matrix.m_posit.m_y += 2.0f;
         NewtonBody* body = CreateSimpleSolid (scene, visualMesh, 10.0f, matrix, compound, 0);
      NewtonBodySetCollisionScale(body, 0.5f, 0.5f, 0.5f);
      NewtonBodySetCollisionScale(body, 0.5f, 0.5f, 0.5f);
      }
   }
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: buoyancy and scaled collisions

Postby Julio Jerez » Fri Nov 28, 2014 1:45 pm

I just pasted that code in the demo, basically you claim that scaling a compound twice does no work, but that code work perfectly, this is the result

Untitled.png
Untitled.png (195.04 KiB) Viewed 8113 times


it does not scale the visual mesh but of you select the option wire frame you will see the collision mesh properly scaled.
I just do not see what is the problem that you are see that I do not.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 1:55 pm

oups yes you're right I forgot that ^^

I'll keep looking from my case.
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 2:11 pm

NewtonCollision* collision = NewtonBodyGetCollision(m_body);
NewtonCollisionGetScale(collision, &pScale.x, &pScale.y, &pScale.z);
do not return the scale set by NewtonBodySetCollisionScale.

is that normal ?
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 3:23 pm

ok just change the scale value from my example above

NewtonBodySetCollisionScale(body, 0.001f, 0.04f, 0.01f);
NewtonBodySetCollisionScale(body, 0.5f, 0.5f, 0.5f);

now you will see :) I tested it on the hollowbox shape
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: buoyancy and scaled collisions

Postby Julio Jerez » Fri Nov 28, 2014 3:59 pm

arkeon wrote:NewtonBodySetCollisionScale(body, 0.001f, 0.04f, 0.01f);
NewtonBodySetCollisionScale(body, 0.5f, 0.5f, 0.5f);


Ha yes that test do reproduces the bug. let me see what is wrong wih that.

and as for compound collision scale, yes they scale is backed into the children shapes so they read a 1, 1, 1

you could check if the collisions is a compound and read the scale for the children.
It makes the interfaces complicated to support that options.

Let me see what is wrong with the test you posted.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: buoyancy and scaled collisions

Postby Julio Jerez » Fri Nov 28, 2014 5:12 pm

Ok I think I have it now, sync and see if it works.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 5:19 pm

Yes it's ok for the shape thanks!

this body still sink on buoyancy forces.
does the correction you made should also be in the plane detection ?
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: buoyancy and scaled collisions

Postby Julio Jerez » Fri Nov 28, 2014 6:42 pm

the reformation of the plane has nothing to do with the scale, the scale bug was that subsequent scale where applies to current scales.
The fix was that I need to reset everything the previous scale, the local matrix and the aliment matrix before I was only resetting the local matrix

I check is the buoyance demos with a hack so tha you can set the scale that show the bug.
sync and find function
void AlchimedesBuoyancy(DemoEntityManager* const scene)

then by the end fin this loop
Code: Select all
for (NewtonBody* bodyPtr = NewtonWorldGetFirstBody(scene->GetNewton()); bodyPtr; bodyPtr = NewtonWorldGetNextBody(scene->GetNewton(), bodyPtr)) {
   NewtonCollision* collision = NewtonBodyGetCollision(bodyPtr);
   if (NewtonCollisionGetType(collision) == SERIALIZE_ID_COMPOUND) {
      NewtonCollisionSetScale (collision, 2.0f, 2.0f, 2.0f);
   }
}


and apply the scale that you think is causing the bug. because I do no see how to test that.
again to see it you nee to go to the option menu and select show collision shape, because the scale do no scale the visual mesh.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: buoyancy and scaled collisions

Postby arkeon » Fri Nov 28, 2014 6:58 pm

ok just use
NewtonCollisionSetScale (collision, 0.5f, 0.5f, 0.5f);

the bodies do not react at all on buoyancy
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 7 guests