- Home /
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.
It's probably fair to point out this is Very Very Hard To Do Well.
Basically you need a lot of REAL STUFF (normally the inside of a car is just E$$anonymous$$PTY).
Secondly also you have to be really adept at switching between different models on the fly. (For example, you'd dump the lower half of the body once it is inside - you'd have to do perhaps 10 or 20 of swaps like that to achieve an effective result. The whole car would likely swap between totally different rigs during this procedure.)
It's a bit like when Brad Bird said to the programmers "and here, she'll stick her finger through the hole in the fabric of the shirt" and they were like "what the hell dude?|"
Hopefully you can find a tutorial from someone who's done it!
FYI, this is a question that gets asked at least 3 times a week. Have a search around the site, and see if you can find some information on the subject.
t's incredible that these forum softwares, don't have a kind of "integrate" facility.
questions that are really all the same, could just be simply presented on the one page. these days, incredibly, modern computers can handle pages more than 1 or 2 folds long :) it would spectacularly, amazingly reduce the clutter on an "answers" site
Answer by bompi88 · Jun 05, 2012 at 09:53 AM
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.
Answer by ROLLERROCK · May 20, 2014 at 12:48 PM
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... :/
Answer by Foxosaur · Jun 05, 2012 at 12:09 PM
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 :p
Thats how I would approach it in my naiveness and general POV.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Official Unity Space Shooter Tutorial 1 Answer
Complete beginner and advanced tutorials for fast learning (preferably C#) 0 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers