Scaling collision shapes (separately for each rigid body)

Post Reply
RazzorFlame
Posts: 5
Joined: Sun Mar 08, 2015 2:31 pm

Scaling collision shapes (separately for each rigid body)

Post by RazzorFlame »

Hi, I'm new to this forum, so... Hi everyone.
I wanted to write add "in three dimensions" in the end of Subjet but it would be too long :) So i want to scale each rigid body shape separately in three dimensions. I know class btUniformScalingShape but from what i saw it can scale shape in three dimmensions by same scalar for each axis. How can i do that? I want my engine to be more memory efficient :)

Thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Scaling collision shapes (separately for each rigid body

Post by Erwin Coumans »

Sharing scaled shapes makes most send for convex hulls with many vertices and concave triangle meshes (such as btBvhTriangleMeshShape), other shapes consume very little memory.

For btBvhTriangleMeshShape, you can share the same underlying triangle mesh. Also, btScaledBvhTriangleMeshShape supports sharing of shape data with non-uniform scaling.

For convex hulls with many vertices, you can use the btConvexPointCloudShape with different non-uniform scaling sharing the same vertices. It might be slightly less optimized than btConvexHullShape.
Thanks,
Erwin
RazzorFlame
Posts: 5
Joined: Sun Mar 08, 2015 2:31 pm

Re: Scaling collision shapes (separately for each rigid body

Post by RazzorFlame »

Hi, thanks for your reply Erwin. I've already implemented what you written about. I have problem with scaling now. I try to scale cylinder i.e in X axis (i need to flatten the shape), but it still rotate on ground like if it was circular. Help me please. I use setLocalScaling(btVector3).
Post Reply