decided to have some fun: driveable vehicle :)

Started by
70 comments, last by RipTorn 21 years, 11 months ago
Okay, an item that is moving in 3D space can be given a direction vector, right? As in a vector, one unit long, pointing the way the object is moving. Any vector can be expressed as (length in the x direction, length in the y direction, length in the z direction), and I was referring to the "length in the x direction" of the direction vector.

How do you know the direction vector? This is something that should be preknown -- it is not derived from the velocity vector as it is the direction the object is facing and acceleration, and not the direction the object is necessarily going. Direction vectors can be calculated by simple trigonometry if you store the direction of your object with angles.
The question is not "why a talking monkey," but rather, "why not a talking monkey." -Monkey Island 4
Advertisement
RipTorn,

I sent you a screenshot that I took while running the demo to your voyager account (I got it off of your website)...

the desktop showed up with normal brightness in the picture, but it is actually bright white when the demo is running. In fact, my desktop icons disappear!

let me know what you think.
I still don''t know why i am getting those errors in the fault.log file.
oh. ops.
that voyager account is gone now. the isp shut down their consumer operation. I''ll have to update the site. sorry.

Vectors and matricies are VERY important to do stuff like this.

this is a basic vector:
(just off my head code)


class Vector3
{
public:

constructors.....

float x;
float y;
float z;

various methods... operators... tools (eg, dot products, cross, inverse cross, normal generators, length tools, etc)
}

To add a vector, you just add the components.

eg:

void Vector3::operator +=(Vector3 vec)
{
x+=vec.x;
y+=vec.y;
z+=vec.z;
}

Vector3 Vector3::operator +(Vector3 vec)
{
Vector3 ret=*this;
ret.x+=vec.x;
ret.y+=vec.y;
ret.z+=vec.z;
return ret;
}


multiply by a scaler (just a single number):

void Vector3::operator *=(float scaler)
{
x*=scaler;
y*=scaler;
z*=scaler;
}
Vector3 Vector3::operator *(float scaler)
{
Vector3 ret=*this;
ret.x*=scaler;
ret.y*=scaler;
ret.z*=scaler;
return ret;
}

Then. for example,
you can have objects positions represented by vectors.
Think of the vector as:

x = position left and right,
y = position forward and back,
z = position up and down


so...

to move an object, just add a vector to it''s position, where the vector is the direction. To accelerate an object:

Vector3 Position;
Vector3 Momentum;

then:

every frame (or the way I do it is fixed, 50 times/sec)

Position+=Momentum*DeltaTimeFrame;

where DeltaTimeFrame is time in seconds since the code was run before. this has been explained before many times.

To accelerate the object, just increase it''s momentum:

if (Accelerate)
Momentum+=DirectionOfAcceleration;

An easy example is gravity, which is something A LOT of people get very wrong. Gravity on earth is acceration down of 9.8 metres/second. Hence:

Momentum+=Vector3(0,0,-9.8)*DeltaFrameTime;

this isn''t perfectly exact, but still good.

As for matricies, they are needed for ANYTHING involving rotation, and are much more complex.

Btw. You must use metres for anything like this. Use imperial measurements and you will end up in one gigantic mess.
it is impressed to me !
i love programe,but more do games,
now i have done a game with OpenGL +Mfc,it''s a 3D flight game
but the interface is bad i think .first all,it is the technique problem.of coure .i am Chinese .software gets behind
special the WEST .
I am luck to see you demo . i admire you very much .
check_815@figage.com
thanks
that means a lot to me
hey riptorn i downloaded like 4 versions of this thing, 3 from here and one old one off oyur site. i must say its quite amazing, keep up the work on this. btw is this going in UPmod? i am a HUGE fan of that mod.

anyways
i got 60fps steady on my AMD XP 1600+ with geforce2mx200 and 256 ddr ram. i have windows 2000 if that helps. good job man.
------------------------"If it says it loves me, how can it be a virus?"
I just found out that 3Dfx Underground is releasing new drivers (v1.09) for the Voodoo5 this saturday (according to their site). Apparently, this version adds the OpenGL 1.2 ICD and has some bug fixes.

So, I''ll try the demo again on Saturday w/ the new drivers and see if I can get in on the fun too... if not, i''ll just have to wait for my new laptop to arrive (ordered it with the 64 Mbyte GeForce 4 440 & 1.8 GHz Pentium 4. Can''t wait!!!)
heh, no, it''s not going in UP

as for the voodoo drivers, that sounds very promising will save me having to write miniGL code.
still working away at this.
I''ve gone NUTS optimizing the rendering.
now, on my geforce 1, I get this:



the last version would have given me about 2.5million/tris/sec max, so I''m *quite* happy with this speed boost

I think the GF 1''s theoretical limit is about 11million, so I''m getting aweful close

http://www.riptorn.8m.com
Turns out the official release version of the new Voodoo drivers has been delayed I tried the beta version, but no luck (although I did stumble upon some bugs in the drivers). Go figure...

This topic is closed to new replies.

Advertisement