Is it possible to make objects NOT fly as if they where in space?

Hi!



I always go into this problem and I think I’v never sloved it really.

When you create a physic object and then throw it away. It will fly (only if you use applyImpulse as applyVelocity doesnt work) as if it were in space.

The gravity is so minimal it’s frustrating!

I set the gravity to -1000000 in y, NO DIFFERENCE!

[java]geo = ShapeManager.ShapeMesh(“Grenade”,“Grenade.png”);

geo.scale(2,2,1);

geo.setLocalTranslation(position);







CollisionShape sceneShape = CollisionShapeFactory.createDynamicMeshShape(geo);



RigidBodyControl body = new RigidBodyControl(sceneShape,1000);

body.setFriction(100);

MainGame.app.getRoot().attachChild(geo);

geo.addControl(body);

body.setGravity(new Vector3f(0,-100000,0));

body.applyImpulse(dir.mult(force), dir.mult(10));

MainGame.app.getPhysics().add(body);[/java]



Has anyone found a way or are everyone creating space games?

Maybe increasing the Mass can work

[java]

body.setMass(x);

[/java]

Just a thought from a beginner

if i was doing a space game, i would personally set anything which moves set to kinematic (just to make life easier). You won’t get normal “physics” collisions with objects though. So they’ll be able to pass through each other, but you can implement your own methods through collision listeners to prevent this happening.

1 Like

You can set the gravity on the physics space. If you set it on the rigid body, I think it has to be after you add it to the physics space and not before, otherwise it wont work

1 Like

Is it possible that you read the javadoc for anything and don’t make the thread title express your general inability to cope with normal issues yourself?

Look at the examples before saying its not possible.

Momoko_Fan said:
You can set the gravity on the physics space. If you set it on the rigid body, I think it has to be after you add it to the physics space and not before, otherwise it wont work

Yes, I would change the gravity on the physics space itself. If you need different objects with different rules of gravity you probably either don't know what you're doing, or you know what you're doing so well you don't need to start this thread :P

For some reason I dont get a documentation in eclipse. So instead I just try all methods that seems relative to the problem

that I’m trying to solve. Didn’t know you could set gravity directly on the physics space tho. I’ll go with that solution.

… better restart on downlaoding jme3 from svn then, till you get proper documentation. Then take a look at the jme3 test examples within jme. There are some with physics.

…and seriously, do you think if there was a bug where all physics object fly nobody would notice?? The engine is used by many to write games successfully, please always expect the problem to be on your side, even (and actually especially) pro programmers do that first. That you cannot get javadoc to work in eclipse is a) not our fault and b) doesn’t stop you from accessing the javadoc on the site here before impressing us with your obliviousness…