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
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JBullet Shaking & Weird collisions  (Read 2021 times)
0 Members and 1 Guest are viewing this topic.
Offline 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:
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: 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:
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: 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?

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: 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.
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  
 
 

 
hadezbladez (2847 views)
2018-11-16 13:46:03

hadezbladez (1030 views)
2018-11-16 13:41:33

hadezbladez (2814 views)
2018-11-16 13:35:35

hadezbladez (553 views)
2018-11-16 13:32:03

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

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

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

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

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

nelsongames (4470 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

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
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!