profile-image
blog-image

Dark Basic Pro: Soccer Game


Designing the Game

Soccer Game

Click on the picture!

The game actually was pretty interesting to develop the easy part was creating the level and getting the character controller working.

Designing the Character Controller

Instead of using the built in character controller I built my own. I needed the player to be able to be pushed around, go up elevators, and interact on almost every level. This would increase the realism.

I had to use a dynamic object and velocity instead of forces. Forces causes weird issues of forcing it's way through solid objects.

Designing the Soccer Ball

This one was pretty easy. I just used the physics sphere that was built in. The tricky part was getting the correct mass of the ball, bounciness right, and forces for each type of kick.

Simulating Kicking

Kicking the ball I had to use some simple trig:

Add Physics Force cos(Angle Y) * Kick_Power, 0, sin(Angle Y) * Kick_Power

By using the Y Angle of the object it will go in the direction the object is facing. I know it technically isn't "physically" kicking the ball but its good enough for a mini game.

Getting those values correct was a lot of trial and error as these things affect the ball:

    • Mass

    • Density

    • Gravity

    • Restitution (Bounciness)

    • Friction (Resistance)

  • Kick Force

All those have to be balanced for it to feel correct.

It was pretty fun to build I have to admit and fun to play when it was done.

A good starting point!