gravity

Started by jt123, November 29, 2011, 10:16:12 PM

Previous topic - Next topic

jt123

Hi,
How can i make a gravity with this engine pls help.

Thank for answers.

EgonOlsen

By coding it...honestly, there's no magic gravity switch. You can have a look at the fps example of the desktop version or the collision detection example in the wiki. Both show a way to do basic gravity...but i'm sure that there are better/different ways.

K24A3

You basically need to add translation on the Y Axis to the Object3D at each frame.

For example (very simple example):

onFrame()
{
    myObject3D.Translate(0f, 0.01f, 0f);
}

jPCT doesn't have a Physics engine so create your own or use something like jBullet.

jt123

How can i use jbullet or how can i detect colission between terain and player.

thank for your answers and sorry for my english

K24A3

You can use the 'checkForCollision' functions, have a look at this example:
http://www.jpct.net/wiki/index.php/Advanced_example

claydergc

Hello,

I've been doing something to simulate some physics issues such as gravity/acceleration, force, mass and velocity, all of this based in one chapter of the book "Game Physics Engine Development".  I created 2 examples to simulate it and you can download it through the following links:

http://www.mediafire.com/?92qlo9ekdbahlf0

http://www.mediafire.com/?nafs5d2hab3k2wy

The first one is the easiest, it only has a sphere that can be shot in 4 different ways (in each shot, acceleration, mass and velocity are changed in the code). The second one is based on JPCT-AE example, but with one extra 3D model (r2d2) that is able to shoot some "bullets" changing the angle in X and Y axis, the velocity is incremented depending on the time that DPAD_CENTER button is pressed. I was thinking in programming some kind of "Gunbound" communicating 2 devices via bluetooth  ;D

I hope this can help  :)