Generic vehicle scene node with a simple editor

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.

Generic vehicle scene node with a simple editor

Postby smso » Thu May 17, 2012 12:26 pm

Link:
http://code.google.com/p/irrcodes/downloads/detail?name=generic_vehicle_scene_node.zip

To compile
==========
Change parameters to point to the proper directories:

main.cpp:
cpp Code: Select all
#define IRRLICHT_DIR "/home/smso/downloads/irrlicht/irrlicht-svn/"


makefile:
cpp Code: Select all
IRRLICHT_DIR = /home/smso/downloads/irrlicht/irrlicht-svn



To start the editor
===================
Run:
./r


Use of the editor
=================
1. Load a body mesh in the scene.
2. Change the body rotation so that it is in the z-direction (as indicated by the blue line).
3. Load a tire mesh.
4. Roughly scale the tires to match with the body.
5. Adjust the tire offsets and tire rotations accordingly.
6. Repeat steps 4 and 5 to refine.
7. Save the params.


Regards,
smso
smso
 
Posts: 217
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Generic vehicle scene node with a simple editor

Postby smso » Thu May 17, 2012 12:51 pm

smso
 
Posts: 217
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Generic vehicle scene node with a simple editor

Postby REDDemon » Fri May 18, 2012 8:49 am

nice :)
OpenGL is not hard. What you have to do is just explained in specifications. What is hard is dealing with poor OpenGL implementations.
User avatar
REDDemon
 
Posts: 831
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Generic vehicle scene node with a simple editor

Postby ACE247 » Fri May 18, 2012 9:06 am

Now expanding to multiple vehicle types :) Will add some tabs at the top for Vessel, Wheeled, Tracked, Rotor Craft, Jet Craft, Rocket. Should have all the bases covered then.
H8L6L5M4G3H5M7N8S7N9O1R8J1P5M7N9O4P2Q5R6T7U4M3N8X6S5T8W (If you want the secret, why not 'TRY' decrypting it? )
This Door's lock doesn't need a key, the Lock is the key to open the Lock and you don't know how to turn the key...
Link: My Blog :)
User avatar
ACE247
 
Posts: 695
Joined: Tue Mar 16, 2010 12:31 am
Location: Namibia

Re: Generic vehicle scene node with a simple editor

Postby aaammmsterdddam » Fri May 18, 2012 10:23 pm

O_O

Just what I was thinking about making (I need vehicles) I assume it uses a zlib license?
(n^(n-n))-1
aaammmsterdddam
 
Posts: 520
Joined: Mon Oct 24, 2011 10:03 pm

Re: Generic vehicle scene node with a simple editor

Postby smso » Sat May 19, 2012 2:34 am

aaammmsterdddam wrote:O_O

Just what I was thinking about making (I need vehicles) I assume it uses a zlib license?


Same as that of the Irrlicht engine.
I learnt much from 3D programs that come with source codes:)

Regards
smso
smso
 
Posts: 217
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Generic vehicle scene node with a simple editor

Postby aaammmsterdddam » Sat May 19, 2012 9:21 pm

then it uses a zlib license, sweet 8-)

Now I should just dissect this and see how it works ^^
(n^(n-n))-1
aaammmsterdddam
 
Posts: 520
Joined: Mon Oct 24, 2011 10:03 pm

Re: Generic vehicle scene node with a simple editor

Postby smso » Mon May 21, 2012 12:50 pm

Updated: 21st May, 2012

A real car pitches when accelerates or brakes. It also rolls to one side on turning a corner.
To add more realism in controlling the vehicle, new functions are added:

cpp Code: Select all
        void pitchBody(f32 degs);
        void rollBody(f32 degs);
        void rotate(scene::ISceneNode* node, const core::vector3df& rot);
        void resetPitch();
 

After setting up the vehicle, press 'A', 'D' to steer it and it will roll to one side.
Press 'W', 'S' to change speed and the vehicle will pitch accordingly.

Changed files:
main.cpp
vehicle_scene_node.h
vehicle_scene_node.cpp

See the first post for an updated archive file.

Regards,
smso
smso
 
Posts: 217
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong


Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 1 guest