Enter/Exit Vehicle Like GTA

Hi Guys. I’m Really Confused… I have searched Everywhere!! But i cannot find any tutorials on creating a vehicle that can be entered and driven and then exit just like gta… I have a car… I have the scripts for a racing game… But no scripts for a car that will work once i enter it… anyone know of a tutorial that follows and ends with the vehicle that i need. thank you for your time to read this and hopefully someone could help me in this issue. Thank you.

Here’s a tutorial that show you how to do it in a FPS kind of way. You could easily change it to 3rd person and make an animation of your character getting into the car, and an animation of the door closing/opening. He uses resources from: here and here. And he has an update of the tutorial here. This is a start though.

ok so i can help u with the coding part so just add this too ur car code-

=========================================================

var EnterPoint : Transform;
var EnterKey : String = “e”;
var DistToEnter = 3.2;
var InCar : Boolean;
var distance = 0.0;
var Player : Transform;
var Car : Transform;
var PlayerCam : Transform;
var CarCam : Transform;

function Update()
{
distance = Vector3.Distance(EnterPoint.position, Player.position);

if(Input.GetKeyDown(EnterKey) && !InCar && distance < DistToEnter)
{
Player.parent = Car;
Player.active = false;
PlayerCam.active = false;
CarCam.active = true;
InCar = true;
}

if(Input.GetKeyDown(EnterKey) && InCar)
{
Player.active = true;
PlayerCam.active = true;
CarCam.active = false;
Player.parent = null;
}

if(InCar)
{
//code for driving the car
}
}

=========================================================

well this should do it!!!
best of luck and srry for answering so late hope this helps someone else… :confused:

Not that I’m experienced in doing the actual programming but the logic simply has to be along the lines of

several different sets of movement controls that get flipped to when the player interacts with the object(car). At the same time flipping the camera and play whatever animations you need to make the car look and sound realistic.

Those controls then get flipped back when existing as does the camera. It only gets more difficult when you want to include animation into it - hope you have a good modeller and time to work with the physics of it all :stuck_out_tongue:

Thats how I would approach it in my naiveness and general POV.