www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: jt123 on November 29, 2011, 10:16:12 pm

Title: gravity
Post by: jt123 on November 29, 2011, 10:16:12 pm
Hi,
How can i make a gravity with this engine pls help.

Thank for answers.
Title: Re: gravity
Post by: EgonOlsen on November 29, 2011, 11:11:17 pm
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.
Title: Re: gravity
Post by: K24A3 on November 30, 2011, 08:20:28 am
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.
Title: Re: gravity
Post by: jt123 on November 30, 2011, 10:08:15 pm
How can i use jbullet or how can i detect colission between terain and player.

thank for your answers and sorry for my english
Title: Re: gravity
Post by: K24A3 on December 01, 2011, 12:51:02 am
You can use the 'checkForCollision' functions, have a look at this example:
http://www.jpct.net/wiki/index.php/Advanced_example
Title: Re: gravity
Post by: claydergc on December 09, 2011, 06:45:00 am
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/?92qlo9ekdbahlf0)

http://www.mediafire.com/?nafs5d2hab3k2wy (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  :)