View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

16 replies to this topic

### #1Jasun220  Members

Posted 08 August 2001 - 05:31 PM

Hey, first of all, let me introduce myself. My name is Jason and im using the Genesis3D Rendering engine for my game (www.genesis3d.com), and the game is going to be a radio control car game. Im at the point of physics for the car, is there any FREE physics engines out there that can simulate RC cars? And i need some information for the camera code, i dont know if i can explain this or not, but you know in racing games how the camera seems to ''float'' and follow behind the car, i need help in getting the effect for a camera. Im not an expert in DirectX or OpenGL, but some code snips or something would be great! - Thanks in advance - Jason

### #2Jasun220  Members

Posted 11 August 2001 - 03:43 AM

Come on guys, i know someone has some information for me...

### #3TerranFury  Members

Posted 14 August 2001 - 02:42 PM

Code your own physics. Besides the fact that I don't know of any "physics engines," it's not too hard to code, anyway. Start simple:

move(float amount, carstruct * car)
{
car->x += sin(car->angle) * amount //In radians
car->y += cos(car->angle) * amount
}

turn(float amount, carstruct * car)
{
car->angle += amount;
}

The end. Read up on vectors - read the vectors and planes article here on gamedev.net. And if you need to get more complicated then that, read up on trig (not too hard) and use common sense (game physics really is mostly common sense, plus a little trig), and if you can't figure something out, then post here. I hope you're successful in coding your RC car game. Just don't make things too complicated.

Edited by - TerranFury on August 14, 2001 9:45:04 PM

### #4Jasun220  Members

Posted 14 August 2001 - 04:16 PM

The engine im using is a prety simple engine to use. so im sure i could get it eventually For all those people making RPG games, i would suggest you lookinto Genesis3D (www.genesis3d.com) and if you have time, download GDemo, it show the power of Genesis3D.

### #5Jedaye  Members

Posted 15 August 2001 - 03:28 AM

I knocked up an RC car demo thing in openGL for an assignment...its not great (less than a weeks work) and was my 1st 3D demo...the sliding i put in tho was very RC car like i thought...

http://www.rbut.demon.co.uk/RC.zip
(you need glut32.dll also cus i used a glut function for the FPS)

As far a physics engines go - there arnt any that I know of...

**
Ste

### #6Jasun220  Members

Posted 15 August 2001 - 04:55 PM

Thats great, thats what i need. May i ask for the source code, so i can learn how to port it to Genesis3D?

### #7Jedaye  Members

Posted 16 August 2001 - 12:34 AM

I would totally give the code out as this is something I strongly believe in (free source for educational purpose). Alas I my HD died leaving me with nothing...I only have the exe as I uploaded it to ftp. I have the code (printed out) as a hard copy of the code was a requirement of the assignment.

If you require direction regarding a specific aspect I am sure I could explainthe theory i implimented...but pls dont ask for every aspect else I will be 92 before I finish the email!

**
Ste

### #8Jasun220  Members

Posted 16 August 2001 - 10:45 AM

Ok, well, the people that are making Genesis3D Classis will have objects with physics in them, so im going to wait until they release their re-built engine. The main thing i was interested in is your camera code, thats my chalenge right now.

### #9bloemschneif  Members

Posted 16 August 2001 - 09:35 PM

take a closer look to this.

### #10penetrator  Members

Posted 19 August 2001 - 11:44 PM

http://home01.wxs.nl/~monstrous/

glHorizon_Project

www.web-discovery.net

Posted 21 August 2001 - 01:16 PM

Well, as others have said, you should read up on vectors, also, create your own physics engine if you can, you''ll know what the hell you did, instead of being left in the dark by someone elses code, to get the "floating" effect of the camera, all you need to do is translate the camera coordinates and have it follow the car at a certain velocity, it wouldn''t be to hard to do, if your using OpenGL, try something like this...

I haven''t really used glulookat or whatever before but you can find info on nehes site i''m sure, it does camera stuff, but do something like this if i''m wrong

make sure you specify that this goes to the camera coordinates, it will move the camera back 5 units.
glTranslatef(0.0f,0.0f,-5.0f):

then do a little loop that makes the camera "follow" the car...

in this example, x will be the actual speed that the car is going, so you can just use this variable from wherever else youre using it.
again, make sure you''re specifying that these are camera coordinates
while(vehicle_speed == x)
{
doing this, will make the camera always follow 5 units behind the car, no matter what speed it is going.
also, i''m not really sure if you can do this with glTranslatef or whatever, i''m kind of new to opengl myself.
vehicle_speed - 5 = camera_speed;
glTranslatef(0.0f,0.0f,camera_speed);
}
that''s just something i came up with in my head, i''m really not sure if it works or not, but you could probably get what i was thinking of from that. hope i helped some.

### #12Jasun220  Members

Posted 22 August 2001 - 01:58 AM

I know what ur saying, in fact thats what i got coded in my G3D game. But that ONLY says 5 or whatever behind the car at ALL times, download that demo from Jedaye, and see how that camera works, that is what i would like.

### #13Jedaye  Members

Posted 25 August 2001 - 05:09 AM

Do you mean the dampening effect?

**
Ste

### #14Jasun220  Members

Posted 25 August 2001 - 06:07 AM

Yeah i guess

### #15Jedaye  Members

Posted 25 August 2001 - 08:54 AM

Thats quite literally a one line thing...along with some stored data...

When you update the camera position vector (in world space) use the equation:

TargetPosition = some value relative to the object you are following;
CameraPosition += ((TargetPosition - CameraPosition) / 16.0f);

Simple eh?

Edited by - Jedaye on August 25, 2001 4:15:10 PM

### #16Jasun220  Members

Posted 25 August 2001 - 10:44 AM

And thatll make the effect just like in that demo? Wow, i thought it would be alot of code.

### #17Jedaye  Members

Posted 25 August 2001 - 12:13 PM

Indeed, simple eh?

there are limitations with this appraoch tho...try playing with the ''16.0f'' value...you will soon find out what i mean...

There are far more complex approaches involving some quite interesting physics (spring equations etc), it all depends upon what you want anf what type of game you are implimenting it in...

I like to think of this one as: Object <-> pole <-> camera Where the camera acts as if its attatched to the objects via a pole and 2 pivets...

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.