physics for a hovercraft

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
dipi
Posts: 10
Joined: Tue Feb 26, 2008 6:16 pm

physics for a hovercraft

Post by dipi »

It's my first project with irrlicht. I started with Irrlicht few years ago but I never get further then adjusting a demo. This year I had to make a program for school (DNI-calculator) -> I needed to learn C++ properly.

It's based on real physics but I simplified it a bit. It only works in 2 dimensions, so you cannot go up or something like that.

example code:

Code: Select all

#include <dipiX.h>
#pragma comment(lib, "dipiX.lib")

//declare all things of irrlicht
// to declare a object || (float) not needed but it gives a warning without
dipiX::thrusters car1((float)10, (float)0.05, (float)1.0, (float)10, device,node);

// to do an action
car1.forward(3);
car1.back(3);
car1.left(3);
car1.right(3);
car1.handbrake(); // to stop completely when driving very slowly

//in famous while loop

car1.update();

The download contains bin, source, example
everything is free to use (if someone can "paint" my plane, I would like the texture :D)
[download]
Last edited by dipi on Sat Aug 29, 2009 7:37 am, edited 1 time in total.
FreakNigh
Posts: 122
Joined: Thu Oct 19, 2006 7:31 am
Location: Orlando FL, USA
Contact:

Post by FreakNigh »

good job :D
Image

CvIrrCamController - 3D head tracking lib to create window effect with webcam
IrrAR - Attach Irrlicht nodes to real life markers
http://www.nighsoft.com/
Skomakarn
Posts: 18
Joined: Mon Aug 03, 2009 1:03 pm

Post by Skomakarn »

Instead of casting to float, just put f after the numbers, and use decimals also for numbers like 10.

10.0f,.05f,1.0f,10.0f
Post Reply