btCollisionShape::calculateLocalInertia() should be const

cgripeos
Posts: 20
Joined: Mon Sep 24, 2007 5:45 am

btCollisionShape::calculateLocalInertia() should be const

Post by cgripeos »

Hello,

I'm new to Bullet physics and this forum.

I was in the middle of integrating Bullet in my code and noticed that calculateLocalInertia() is not a const function. I looked at some(but not all) of the definitions in different shapes and decided that it would be nice if it was.

What do you guys and girls think about making it one?

Thanks in advance,
cg

P.S. I just noticed that the RigidBody costructor takes a non-const collision shape. Does it need to? can we change it to be a const shape?
cgripeos
Posts: 20
Joined: Mon Sep 24, 2007 5:45 am

Re: btCollisionShape::calculateLocalInertia() should be const

Post by cgripeos »

anybody?
no?

ok, I'll start by making the changes locally, I guess.

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

Re: btCollisionShape::calculateLocalInertia() should be const

Post by Erwin Coumans »

I agree, the 'calculateLocalInertia' should be const.
P.S. I just noticed that the RigidBody costructor takes a non-const collision shape. Does it need to? can we change it to be a const shape?
This would cause more hassle, because it would make it more inconvenient to make any changes to a collision shape, unless you force users to keep their own pointer to the shape separately.
However, I'll try to make the 'calculateLocalInertia' const.

Thanks for your patience, I'm very busy with various projects.
Erwin
cgripeos
Posts: 20
Joined: Mon Sep 24, 2007 5:45 am

Re: btCollisionShape::calculateLocalInertia() should be const

Post by cgripeos »

Thanks for the input, Erwin!
Your work on Bullet is greatly appreciated!


Just a thought...
I guess if a shape was deformed via the RigidBody (assuming the shape is not shared with other Rigid Bodies) then it would need to be NON-const. Otherwise, the RB just needs a const shape, since it will never need to make any changes to it.


Anyways, non-const is fine with me. I'll get used to it :)

Thanks again for your time,
cg