Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
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 1851 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 (1675 views)
2018-06-10 19:43:48

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

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

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

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

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

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

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

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

Solater (973 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
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!