Where do I start ?

BlitzMax Forums/MiniB3D Module/Where do I start ?

Brucey(Posted 2007) [#1]
Okay... I have zero 3D programming experience, and want to get into this using MiniB3D (obviously!).

Can someone point me in a general direction of where I should start, please?

I'd really like to get to the point where I can code a very basic demo for my FlightDynamics module, that will let you fly a plane around a world. (I have the engine running in "theory" on a static 2D screen, with all the data on-screen, and some images showing pitch/bank etc).


I've found it easier to pick up C++ in three weeks to write the Qt GUI Module, than I have to work out what all these 3D things do... :-/

Help... *sniff*

;-)


skidracer(Posted 2007) [#2]
A good programmer would sit down and write a quick design document (yeh right).

FlightDynamics B3D Example Project

1 Create a basic scene

Add a camera, light and cube, then spin the cube in front of the camera by calling RotateEntity every frame.

Now move the cube with the arrow keys and track the cube with the camera. Use MoveEntity for forwards and back, TurnEntity to rotate. You should now hopefully be able to driver the cube round the screen and have the camera follow it.

Replace the cube with a plane model and map the pitch yaw and roll of the FlightDynamics engine to the model. You may need to call RotateEntity then TurnEntity for the other axiis if the order of rotation is different to that of minib3d.

Now lock position of the plane to the FlightDynamics engine, PositionEntity is the function for that.


ksalomao(Posted 2007) [#3]
I don't know if this will help. but take a look at this sample code and then look at the docs and the examples for more info (the blitz3d docs are very explanatory).




bradford6(Posted 2007) [#4]
2D Graphics have 2 "D"s whereas 3D Graphics have an Extra "D" thus making it 3D.
in pseudocode...(2D + Extra "D" = 3D)

seriously though.
The 3D world in miniB3D is laid out in a 3D Grid. Starting at the origin (0,0,0) .
When you create an Entity (Loadmesh, Createcube(), Createsphere() , etc) the entity is placed at the origin.

A typical Scene is created with a Camera, a Light and a Mesh (or several Meshes)

When you call Renderworld, the 3D Objects in the scene are rendered from the point of view of the active camera.

This is slightly different from the way Max2D works in that renderworld renders all objects in view based on their positions. You do not need to manually cycle through the objects and 'draw' them.


1. Turnentity will change the pitch, yaw, roll of the Entity.

2. RotateEntity will SET the orientation to the Pitch, Yaw, Roll Values you feed to it.

like skid mentioned, you will probably need to use Rotate vs turn.

at first, you might want to use Pointentity to 'lock' the camera on your airplane.

a note about Coordinate systems:

JBsim uses Quaternions
from their web page (...but quaternions are used to track orientation, avoiding "gimbal lock". )

miniB3D uses Eulers internally, Blitz3D uses Quaternions. There is a method (posted in thes forums) to convert Eulers to Quats and vice-versa.

If you are going to do alot of conversions, you might need to get a good grasp of Matrix math, Eulers and Quaternions. (If you don't have that knowledge already, which I suspect you do :) )

there is actually a reference right on the flightdynamics page:
http://jsbsim.sourceforge.net/fsdocuments.html
under Quaternion reference.

LeadWorks and Simin H have recently posted alot of stuff about this, worth a look.

wow. you don't mess around. most people make their first dabble in 3D something like a mario clone but not you, you go straight for the Advanced Flight Dynamics stuff. Cool!

EDIT:
I noticed this in the Class Reference under FGQuaternion:

FGQuaternion is a representation of an arbitrary rotation through a quaternion. It has vector properties. This class also contains access functions to the euler angle representation of rotations and access to transformation matrices for 3D vectors. Transformations and euler angles are therefore computed once they are requested for the first time. Then they are cached for later usage as long as the class is not accessed trough a nonconst member function.



so you may not need to do these conversions manually.


Brucey(Posted 2007) [#5]
Thanks folks. Lots to get my teeth into :-)

Apparently I should feed the ground altitude into the engine too, but if I read correctly somewhere, miniB3D isn't doing terrain stuff yet, so I'll just have to pretend the world is flat.

you go straight for the Advanced Flight Dynamics stuff

It's all much the same, isn't it? Just that the engine tells me where I am, what direction I'm pointing in, and if I'm upside down or not ;-)

In fact, to me it seems easier to do that than a Mario clone...

Anyways... I'll be back if I get stuck :-)


Brucey(Posted 2007) [#6]
I've also stumbled across the Blitz3D tutorials section, which looks like a useful place for information!! (surprisingly...)


North(Posted 2007) [#7]
Thats a great thing about MiniB3D - B3D Forums are full of helpful information :)