Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (763)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (852)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JBullet Shaking & Weird collisions  (Read 1797 times)
0 Members and 1 Guest are viewing this topic.
Offline Ecumene

JGO Kernel


Medals: 197
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:
Click to Play


They shake also:
Click to Play


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.

Offline 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
Offline Ecumene

JGO Kernel


Medals: 197
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:
Click to Play

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Kefwar
« Reply #3 - Posted 2014-12-14 18:23:11 »

1  
dynBody.setActivationState(CollisionObject.DISABLE_DEACTIVATION);


This keeps them shaking.

Offline Ecumene

JGO Kernel


Medals: 197
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?

Offline 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.
A bit more info: Activation States

Offline Ecumene

JGO Kernel


Medals: 197
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.
A bit more info: Activation States

Setting it to ACTIVE_TAG seems to make it stop for object that are colliding with the plane... But not other boxes. ( I'm assuming this is probably intended )
Thanks for the help!

Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (543 views)
2018-06-10 19:43:48

EgonOlsen (647 views)
2018-06-10 19:43:44

EgonOlsen (444 views)
2018-06-10 19:43:20

DesertCoockie (789 views)
2018-05-13 18:23:11

nelsongames (1023 views)
2018-04-24 18:15:36

nelsongames (1057 views)
2018-04-24 18:14:32

ivj94 (1636 views)
2018-03-24 14:47:39

ivj94 (561 views)
2018-03-24 14:46:31

ivj94 (1442 views)
2018-03-24 14:43:53

Solater (566 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!