Jump to content


Photo

How do I make a 3D Car


  • This topic is locked This topic is locked
6 replies to this topic

#1 Dimidoosie

Dimidoosie

    GMC Member

  • GMC Member
  • 77 posts
  • Version:GM8

Posted 25 February 2012 - 05:45 PM

I need to know how to make a 3D car for a racing game. I will be using a simple block model for the actual car object, but I don't really know how to make a 3D car move, or how to make the camera stay behind the car while steering. A lot of examples I have found had cameras that tried to be too fancy, and cameras that had a hard time staying stationarily behind the car (especially when going in reverse), and following at a steady pace. I don't like overhead bird's eye views, and I don't like it when the camera is too far away from the car. This is 3rd Person view we are talking about.

Anyway, the car will be controlled by the player using the arrow keys. I need to know how to cleanly accelerate and deccelerate, how to make it go forward and backward, and how to make a simple steering motion to the left and right, all with the camera following closeley behind (but not too closely)

I need a very good and thorough explanation on how to get this done, and multiple methods on doing so would actually be nice, just so I have some options.

Oh, and when the block (car) accelerates & deccelerates, I also need to know how to limit the speed of the vehicle (so that it doesn't go too fast), and how to make it cleanly and smoothly stop when it collides with something (like a wall)

I'm not looking for advanced physics or how to make it go up or down slopes, but I may ask for those later. Don't bring that into your explanation unless I ask.

All I want is a simple player-controlled car that moves around as a car should, and stops when it collides with a wall, to summarize this whole thing.

Edited by Dimidoosie, 25 February 2012 - 09:24 PM.

  • 0

#2 hit172

hit172

    GMC Member

  • New Member
  • 189 posts
  • Version:GM8

Posted 25 February 2012 - 09:00 PM

Does anyone still have a copy of the old percsich.hu tools and examples. There was a good car example in that. I can't find a copy anymore.
  • 1

#3 Dimidoosie

Dimidoosie

    GMC Member

  • GMC Member
  • 77 posts
  • Version:GM8

Posted 25 February 2012 - 09:05 PM

Does anyone still have a copy of the old percsich.hu tools and examples. There was a good car example in that. I can't find a copy anymore.


I don't want an example. I just want assistance. Please do not post unless you are posting an actual explanation on how to do it. I don't mean to be rude.

I don't want an extension package either. Just please guide me through the steps.

Edited by Dimidoosie, 25 February 2012 - 09:06 PM.

  • 0

#4 Rexhunter99

Rexhunter99

    GMC Member

  • GMC Member
  • 922 posts

Posted 25 February 2012 - 09:40 PM


Does anyone still have a copy of the old percsich.hu tools and examples. There was a good car example in that. I can't find a copy anymore.


I don't want an example. I just want assistance. Please do not post unless you are posting an actual explanation on how to do it. I don't mean to be rude.

I don't want an extension package either. Just please guide me through the steps.

From your post I can already assume several things, you do not have much if any programming experience at all and from the way you posted i can assume that you are also a person who is not suited to programming at all, some of what you asked belongs in an entirely different sub-forum and is part of the most basic features of a game creation engine such as Game Maker. You haven't given the Game Maker manual even a once over to find out what functions will help you and you haven't done anything to help yourself other than come here and demand (yes demand) that we make something for you and tell you how it works.

For making a car there are at least a dozen ways to do so, you could use a modelling utility such as GM Model Creator v5, G-Max with my exporting maxscript, Blender with the Blender export plugin, you could hand construct a model from vertices within GML or use primitive shapes to make a model. I don't think I need to explain this as it has already been asked (how do I make 3D sprites/models) so many times before that I am surprised no one has stickied a topic about it out of frustration.

For making it rotate and move you only need the transformation functions such as d3d_transform_set_identity() and d3d_transform add_rotation_z() these are a little tricky for newbies so I guess I can explain them here,
d3d_transform_set_identity()
Resets the transformation stack to the default (must call before you begin transforming and after you draw the model.
d3d_transform_add_rotation_*( angle )\
* indicates either x,y,z rotation, z rotation is the default yaw (turning) axes in 3D if you use a 0,0,1 up vector in the projection
d3d_transform_add_translation(x,y,z)
This moves your model around, give this the x,y value of the object instead of d3d_model_draw() or other drawing functions to allow other transformations like scaling and rotation.
d3d_transform_add_scaling(x,y,z)
This will scale the model depending on the values you attribute it, you can scale a model on any axes.

So to recap, you can draw a model using the primitive shape functions or model your own car in an external editor and draw the car via d3d_model_draw() and then rotate it and move it via the transformation functions shown above, we won't do this for you, this is your task.

I have reported your post, you were incredibly rude to hit172 who was only trying to help you, and your entire original post in the topic does not belong here, we do not make things for you, we are here to be asked questions regarding specific code problems or idea implementations.

I'm not looking for advanced physics or how to make it go up or down slopes, but I may ask for those later. Don't bring that into your explanation unless I ask.

This is incredibly rude, here you are making it out like we are your servants and do as you bid and do not act as anything other than automatons.

Sorry but quite frankly, you are very lucky that I answered your post (and that I was in a rather good mood at the time) instead of someone else who would be just rude back to you.

All other potential posters, do not clog up this topic any further, a moderator will look at it and decide what to do and until then we should not keep posting as I have given the user the answers he needs, not what he desires and any more help is not necessary and a waste of time in my personal opinion.

If anyone has an issue with how I posted, PM me.
  • 3

#5 starfire_64

starfire_64

    Galactic Flame

  • GMC Member
  • 125 posts
  • Version:GM8.1

Posted 25 February 2012 - 10:23 PM

Hey! Use the lengthdir functions to offset the camera. Like so:
Xto = car.x
Yto = car.y
Zto = car.z
// point at the car
Xfrom = lengthdir_x(100,car.direction-180)
Xfrom = lengthdir_x(100,car.direction-180)
// 100 pixels behind the car
Xfrom = car.z+20
// 20 pixels above the car
d3d_set_projection(Xto,Yto,Zto,Xfrom,Yfrom,Zfrom,0,0,1)

  • 1

#6 Dimidoosie

Dimidoosie

    GMC Member

  • GMC Member
  • 77 posts
  • Version:GM8

Posted 25 February 2012 - 10:50 PM

I apologize for my behavior. Thare is no excuse for what I have done.

I am apparently posting these topics in the wrong forum. I will rephrase these topics and make them less rude, then I will post them in the "Novice/Intermediate" forum. I over-estimated my skill level a LOT in Game Maker, so maybe I'll be much more at home there.

Edited by Dimidoosie, 26 February 2012 - 12:15 AM.

  • 0

#7 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 22051 posts
  • Version:GM:Studio

Posted 26 February 2012 - 10:47 AM

I apologize for my behavior. Thare is no excuse for what I have done.

I am apparently posting these topics in the wrong forum. I will rephrase these topics and make them less rude, then I will post them in the "Novice/Intermediate" forum. I over-estimated my skill level a LOT in Game Maker, so maybe I'll be much more at home there.


That's a GREAT attitude! GameMaker is very easy, but that does not mean that you can instantly make whatever you want with it... There is a learning curve and it is unique to each person, so realising your initial limitations is the key to getting over them and getting better. Go ahead and post a new topic in the Novice forum and I'll close this for now, and I wish more people had your attitude and apparent wish to actually learn from your mistakes!

All the best!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users