Labels

October 29, 2012

RGP day 9 - physics

So today I am doing something completely different I've done so far - the physics system. It is the next big challenge aside from the track coordinates and AI.
For collision detection and simpler stuff I will be relying on Blender's Bullet Physics system, but more advanced things - track space constraints, hover spring-damper system, vehicle handling and behaviors I will have to write from a scratch. And as an artist I am very good at it :P. Fortunately we have an Internet and there are a lot of really helpful resources for this.

The first thing I tried to implement was a mass-spring-damper system. I will be using it to make the vehicles levitate above the ground/racetrack surface. The idea is to cast a ray from the vehicle's vertical axis down. If it collides with a surface the spring-damper simulation will run and apply the calculated force to the vehicle.
The most helpful resource I found had an actual Blender Game Engine implementation already :). HERE is the link where I found it. It is done by Sebastian Korczak, same guy who is making the Burster - a web browser plugin to allow publish and play Blender files online. I will be using it at one point of development to show off the progress.
So after some changes I had a nice springy levitating box.

Another thing I managed to create - a force field that will keep the race car close to speedway's surface, thus preventing the vehicle to fall off the track surface even if the speedway is oriented upside down.

For those who have Burster plugin, can play around here in the browser:
(I have no idea if it works or not, I am currently on mac)
controls: arrowkeys Left/Right



or blend file HERE

10 comments:

  1. It's a bit jittery and inconsistend IMO. FOr one section it will only be so high, then in the rough part it'll be way higher.

    ReplyDelete
    Replies
    1. indeed, but thats a matter of value tweaking and polishing till I get the desired feel. The blend just serves as a proof of concept right now.

      Delete
  2. The ship will jump away from the track if the ship travels to quickly. Have you tried using the distance constraint, material physics coupled with servo motion? They are a bit low tech, but they should should save you some overhead if you plan to have many AI ships.

    ReplyDelete
    Replies
    1. Although, since all ships/cars will move more or less at the same speed, it would be a cool thing that part of the track you are all flying high in the air.

      Delete
  3. As an example: http://www.pasteall.org/blend/17185

    Press the up cursor to travel forwards.

    ReplyDelete
    Replies
    1. whoa, nice. The "Constraint" actuator is actually something new to me, thanks! Thats exactly what I am trying to achieve there :)

      Delete
  4. Glad I could be of some help!

    Paul (Rubbernuke on Blenderartists).

    ReplyDelete
  5. Cool progress here! can't wait for more TechCandy!

    Sparazza

    PS: The burster works well here (Ubuntu 64 + Firefox)

    ReplyDelete
  6. Awesome work! Waiting for next RPG day.

    For lazy ones like me here's Buster plugin:
    http://geta3d.com/index.php?option=com_content&view=article&id=38&Itemid=18

    As a non-Blender guy I really enjoy this plugin.

    ReplyDelete
  7. Wow! Keep the good work up! I'd love to see this game finished. Especially by you.

    ReplyDelete