Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 9 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Mass not effecting dynamic rigid bodies?Posted: Sun Mar 19, 2017 10:53 pm

Joined: Tue Jan 31, 2017 8:07 pm
Posts: 39
It appears that whatever I set my object's mass to be, it has no effect on how it behaves in the scene. When changing the gravity, my object falls faster or slower, but not when changing the mass (even from 1 to 10000, no change).

Am I doing something wrong here?

Code:
btCollisionShape* bulletCollisionShape = new btBoxShape(btVector3(0.05f, 0.1f, 0.05f));
btScalar bulletMass = 1;
btVector3 bulletInertia(0, 0, 0);
bulletCollisionShape->calculateLocalInertia(bulletMass, bulletInertia);

...

btRigidBody::btRigidBodyConstructionInfo bulletRigidBodyCI(bulletMass, bulletMotionstate, bulletCollisionShape, bulletInertia);

Top

 Post subject: Re: Mass not effecting dynamic rigid bodies?Posted: Sun Mar 19, 2017 11:03 pm

Joined: Thu Apr 14, 2016 3:44 pm
Posts: 38
gravity accelerates all objects equally https://www.youtube.com/watch?v=5C5_dOEyAfk

Top

 Post subject: Re: Mass not effecting dynamic rigid bodies?Posted: Mon Mar 20, 2017 8:57 pm

Joined: Tue Jan 31, 2017 8:07 pm
Posts: 39
Well how can I have objects that fall differently then, without changing the gravity?

Top

 Post subject: Re: Mass not effecting dynamic rigid bodies?Posted: Mon Mar 20, 2017 10:45 pm

Joined: Fri Nov 04, 2005 2:22 pm
Posts: 109
I use setLinearFactor()...

http://www.bulletphysics.org/mediawiki- ... e_Snippets

may be is wrong but for my engine is good... try.

Top

 Post subject: Re: Mass not effecting dynamic rigid bodies?Posted: Mon Mar 20, 2017 11:50 pm

Joined: Tue Jan 31, 2017 8:07 pm
Posts: 39
Hmm, I tried setLinearFactor() but after entering the weight of my bullet (0.00745KG) for the y-axis value, it just stops mid-air after falling slightly.

Top

 Post subject: Re: Mass not effecting dynamic rigid bodies?Posted: Tue Mar 21, 2017 12:08 am

Joined: Tue Jan 31, 2017 8:07 pm
Posts: 39
Is this to do with my stepSimulation()? I'm currently doing dynamicsWorld->stepSimulation(1 / 60.f, 10) but I've tried using deltaTime and my object just instantly appears on the ground then, it's so fast.

When I draw the scene with a debug drawer, the object seems to be falling as expected (with different gravities at least, mass still has no effect), which is even weirder because I don't see how that would affect things.

Top

 Post subject: Re: Mass not effecting dynamic rigid bodies?Posted: Thu Mar 23, 2017 11:33 am

Joined: Thu Mar 23, 2017 11:17 am
Posts: 3
jimjamjack wrote:
Is this to do with my stepSimulation()? I'm currently doing dynamicsWorld->stepSimulation(1 / 60.f, 10) but I've tried using deltaTime and my object just instantly appears on the ground then, it's so fast.

When I draw the scene with a debug drawer, the object seems to be falling as expected (with different gravities at least, mass still has no effect), which is even weirder because I don't see how that would affect things.

There is a diference between delta time and time step. Delta time is using to calculate the last time passed since the frame start, time step is how many steps do you want to use in this process. For example, only call this function if the delta_time is greater than 16.6 (in miliseconds), you need this if in your engine there is a frame that consumes a lot of time to process a task and your delta_time increases

Top

 Post subject: Re: Mass not effecting dynamic rigid bodies?Posted: Thu Mar 23, 2017 11:50 am

Joined: Sun Jan 07, 2007 4:29 pm
Posts: 79
Location: Oxford, England
If you want heavy objects to fall (accelerate) faster than light ones, you have to ask yourself why. The most likely answer is that the objects are affected by drag (air resistance) too - in which case rather than hacking gravity, it's probably better to add a drag force. This will give more realistic motion in all directions, not just vertically.

Drag affects lighter objects more because the drag force is calculated as:

dragForce = CL * dynamicPressure * area

where

* CL is the coefficient of drag (look it up - for a sphere it's around 0.5)
* dynamicPressure = 0.5 * airDensity * speed^2 where speed is the speed of the object relative to the air.
* area is the cross-sectional area of the object (pi r^2 for a sphere).
* the force acts in the direciton opposite to the motion of the object relative to the air.

This force only depends on the properties and motion of the object - not on its mass. The acceleration it produces is therefore greater on objects with low mass, since acceleration = force / mass (Newton's second law). That's why a feather falls slower than a stone on earth, where there's an atmosphere, and on the moon where there's not. It's also why you can throw a stone further than a feather (on Earth).

Top

 Post subject: Re: Mass not effecting dynamic rigid bodies?Posted: Fri Mar 24, 2017 1:10 am

Joined: Tue Jan 31, 2017 8:07 pm
Posts: 39
Thanks DannyChapman, I'm assuming this is what I'm looking for. Does Bullet have built-in functions for altering a specific rigidBody's drag?

The reason I posted the thread was because I found it strange that my bullet object was falling extremely quickly under the default "earth" gravity, and when trying to change this by altering the rigidBody's mass, obviously had no success. So although I could probably just alter the gravity, it seems like a bit of a hack, so drag seems like the way to go.

But yeah, finding the right values for 'dragForce = CL * dynamicPressure * area' for my own model would be a bit of a pain so hopefully Bullet has something to help with it.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 9 posts ]

 All times are UTC

Who is online

Users browsing this forum: Exabot [Bot] and 22 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities