Convex Hulls ignore offset matrix

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Convex Hulls ignore offset matrix

Postby aitzolmuelas » Fri Aug 14, 2015 6:54 am

I am attempting to create dynamic convex hulls from meshes, the result I get is that the mesh geometry is offsetted to be centered around the origin, then that offset is applied to the CollisionMatrix (I understand this is to improve precision of floats). However, the resulting convex hull is not offset (it seems to ignore the matrix) but its center of mass is (if I artificially set the collision's offset matrix it does not appear affected by the matrix, but it wobbles as though its center of mass IS affected by said matrix).
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Convex Hulls ignore offset matrix

Postby Julio Jerez » Fri Aug 14, 2015 8:49 am

yes point of a convex mesh are offset by the center, the offset matrix is calculated , but it should work fine, or at least if has until now.
It come to this, if you make convex hull with an identity matrix, and you read the matrix arte you created, the matrix will by non identity
did you change the matrix after you make the hull? if you did you should concatenate wit the existing one.
can you reproduce that on the sandboxdemo?
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex Hulls ignore offset matrix

Postby aitzolmuelas » Fri Aug 14, 2015 10:39 am

Yes, the matrix is non-identity, and I concatenate it with the additional offset matrix before assigning it again to the collision, but it only seems to be affecting the center of mass, not the actual collision geometry (I will try to reproduce in sandbox)
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Convex Hulls ignore offset matrix

Postby Julio Jerez » Fri Aug 14, 2015 10:44 am

the collision mesh never ever changes, but the offset matrix, the inertia, the scale, and the center of mass do.
See if you can reproduce in the sand box.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex Hulls ignore offset matrix

Postby aitzolmuelas » Fri Aug 14, 2015 11:54 am

Ok, it's solved, my fault after all... I could not reproduce in sandbox, so I went back to my code and found out the game entity that has the convex hull receives a move message after being inited, and I had not fixed that message to take into account the extra offset added by newton, so it was being overwritten after all.
Sorry about the fuss...
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Convex Hulls ignore offset matrix

Postby Julio Jerez » Fri Aug 14, 2015 12:01 pm

only tow primitive shapes make apply matrix offset, the convex hull and the cone.

although I net the code was removed when I added the scale, but I will put It back, because the cog is actually not the geometrical center. All other primitive has the offset as identity.

I general you should always consider that the primitive has an offset matrix, for some will be identity and for other won't, that will make your code general and simple.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 3 guests