Page 1 of 1

Scaling MobileMesh

Posted: Sun Apr 14, 2013 7:05 pm
by Wilhelm
I have been looking around for a solution for awhile but I can't find any for scaling the mobilemesh & the convexhull entities.
The AffineTransform can scale them at initialization but howabout after, continuously.

Does anybody know a solution to my problem?

Re: Scaling MobileMesh

Posted: Sun Apr 14, 2013 7:21 pm
by Norbo
Dynamic scaling is a nonphysical operation in rigid body physics, so it's not uniformly supported. You could go in and modify the MobileMeshShape to allow it, but to do so, you'll have to repeat some of the work done in the constructor. For example, changing the affine transform potentially changes the center of mass, requiring a recentering. You could also just recreate the shape with the new transform.

Scaling ConvexHullShapes is a little easier. You can put the ConvexHullShape into a TransformableShape and modify the TransformableShape's linear transform. It will propagate the updates to entities using the shape.

Also, when I said it was a nonphysical operation, I mean the collision solver will not be able to deal with it rigidly. Object resizing is treated as a form of teleportation; it isn't velocity based. New or deeper collisions caused by expansion will be resolved by the 'squishier' baumgarte velocity feedback instead of a solid rigid response. To see what this looks like, try spawning a box in another box.

Re: Scaling MobileMesh

Posted: Sun Apr 14, 2013 8:05 pm
by Wilhelm
Thanks for your answer!
I guess I will take a look at the constructor in order to save the garbisch collector some work :wink: