# Trials Kings game

Discussion in 'Works In Progress' started by khos85, Apr 21, 2014.

1. ### khos85

Joined:
Jul 21, 2013
Posts:
541
Hi,

I making a trial bike game called "Trials Kings", a trial bike game but this is of the pedalling variety so nothing like the motorbike type (seem to be a couple of those around), check a youtube video of what it looks like now:

It has been a bit of a challenge/learning curve to get the Blender animations working so far, but I am starting to get the hang it I think.
I still want to figure out how to make gravity pull the bike down faster, currently it seems to be a bit "floaty".

Cheers,

2. ### Nicolas-Liatti

Joined:
Jun 19, 2013
Posts:
89
There are several solutions for gravity, depending on how works your game:
- change the global gravity of the projects in the projects settings
- create your custom gravity: when the bike is in the air change the velocity of the bike on the y axis

Cheers,

3. ### khos85

Joined:
Jul 21, 2013
Posts:
541
Hi, thanks for the info, If Change gravity, then I'll need to change addforces etc too right on objects, to i.e lift a wheel up?

4. ### Nicolas-Liatti

Joined:
Jun 19, 2013
Posts:
89
I think so. It's at least worth a try to see if this helps.
In my projects I simply changed the velocity on the specific object when it's in the air and it works perfectly.
For example "velocity.y -= 30.0f * Time.deltaTime;"

5. ### khos85

Joined:
Jul 21, 2013
Posts:
541
Thanks for the tip, have you got any ideas how I can test if the object is in the air?

6. ### Nicolas-Liatti

Joined:
Jun 19, 2013
Posts:
89
There are several ways. An easy one is to launch a ray on the y axis from the bottom of the bike, and check when it touches something. If the distance between the bottom of the bike and the point is small (f.e. < 0.1f), then it means you are on the ground. If it's bigger, you are in the air.

7. ### khos85

Joined:
Jul 21, 2013
Posts:
541
Cool, that seems to help, thanks very much, I think I managed to get it working better now.

unityunity