Java-Gaming.org Hi !
 Featured games (90) games approved by the League of Dukes Games in Showcase (791) Games in Android Showcase (234) games submitted by our members Games in WIP (864) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 JBullet Shaking & Weird collisions  (Read 2021 times) 0 Members and 1 Guest are viewing this topic.
Ecumene

JGO Kernel

Medals: 200
Projects: 4
Exp: 8 years

I did not hit her! I did not!

 « Posted 2014-12-14 17:52:55 »

I've been playing around with JBullet, but I've noticed a few errors.

Sometimes it does this:

They shake also:

I've just recently gotten into JBullet seriously, and I don't know much about it. I'm pretty sure the delta-time between frames is being calculated & processed correctly... Also, I'm certain it's not the graphics engine, because the object's transforms are done directly from the JBullet matrices.

matheus23

JGO Kernel

Medals: 138
Projects: 3

You think about my Avatar right now!

 « Reply #1 - Posted 2014-12-14 18:05:09 »

It looks like these things masses are too big. How do you calculate / set the mass of the objects?

See my:
My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Ecumene

JGO Kernel

Medals: 200
Projects: 4
Exp: 8 years

I did not hit her! I did not!

 « Reply #2 - Posted 2014-12-14 18:11:18 »

It looks like these things masses are too big. How do you calculate / set the mass of the objects?

Here's where I initialize the rigid bodies for boxes:
 1  2  3  4  5  6  7  8  9 `CollisionShape boxShape = new BoxShape(new Vector3f(8, 8, 8));MotionState boxMotionState = new DefaultMotionState();Vector3f boxInertia = new Vector3f(0, 0, 0);boxShape.calculateLocalInertia(2.5f, boxInertia);RigidBodyConstructionInfo boxConstructionInfo = new RigidBodyConstructionInfo(2.5f, boxMotionState, boxShape, boxInertia);boxConstructionInfo.restitution = 0.2f;boxConstructionInfo.angularDamping = 0.95f;RigidBody dynBody = new RigidBody(boxConstructionInfo);dynBody.setActivationState(CollisionObject.DISABLE_DEACTIVATION);     `

( The mass is 2.5f in the rigid body construction info )

When I set it to 0.5f, it kinda helps:

Kefwar
 « Reply #3 - Posted 2014-12-14 18:23:11 »

 1 `dynBody.setActivationState(CollisionObject.DISABLE_DEACTIVATION);`

This keeps them shaking.

Ecumene

JGO Kernel

Medals: 200
Projects: 4
Exp: 8 years

I did not hit her! I did not!

 « Reply #4 - Posted 2014-12-14 19:06:39 »

This keeps them shaking.

Which one should I use?

Kefwar
 « Reply #5 - Posted 2014-12-14 20:22:39 »

Which one should I use?
If I remember it correct, you don't have to set it. The default one is the one you are looking for.

Ecumene

JGO Kernel

Medals: 200
Projects: 4
Exp: 8 years

I did not hit her! I did not!

 « Reply #6 - Posted 2014-12-14 20:41:11 »

If I remember it correct, you don't have to set it. The default one is the one you are looking for.