- Home /
The question is answered, right answer was accepted
Vehicle Enter/Exit System for First/3rd Person :)
Hello People,
MY SCRIPT WILL BE AVAILABLE ON THE ASSET STORE FOR $15 VERY SOON!!
A GTA STYLE GAME WOULDNT B POSSIBLE WITHOUT IT!!!
WHAT IT CAN DO:
You can Simply run up to your car, press a key ("e" in my case) and enter your car. at this point your character is invisble and you can drive your car around while your invisible character gets steady moved with it. after pressing another key - (in my case "r") your character gets visible again and stands right besides your car. and you are now able to controll your character again while your car still stands where u left it. :)
I have problem with that script.. I attached it into my car and filled right information.. Then i go to player, but when i run somewhere very far of my car and i click "e" in my case, player can drive car and when i click "r" (exit), player stands near car and car continues driving forward, then i click "e" (enter) again, and player can drive car.. So simply, my problem is that i have little box with trigger near my car, but when my player doesnt even hit that trigger, it can drive that car!
Please help me!
Thanks very much in advance! :)
@ALL POSTERS:
Please, this is a Q&A site! Each "Question" have only one question at the top and the "Answers" should answer that question, nothing else. If you have further questions on a specific post use "add new comment". This site is not a forum to chit chat. I've cleaned up the answers and converted some of them to comments.
Also, please read the FAQs! This site is for clear and specific questions and for clear and specific answers. The accepted answer here on this question is not an answer!!!
If you like to chat with each other, visit the Unity Forums
Ohh, and don't post the solution into the question! It's a total mess already. I don't have the time to disassemble this mess and reorder it. Please let the question be a question and post an answer if you have a solution. You can edit your posts at any time.
Answer by Yung-Hustla · Mar 09, 2011 at 01:44 AM
ALRIGHT PEOPLE IM SORRY TO TELL YOU THAT..... But i wont provide the Vehicle Script for free anymore. send me $99 to my paypal and u'll get the fully working script. The good news is that i have renewed the whole script to it works even better and is much easier to set up. I made this decision because whenever i asked people that are using my script to provide scripts that I needed for my project for free... they refused me and sent me overpriced links to their asset store.
SO... ill do the same and make at least some money to afford their Assets.
Anyone who downloaded my script already feel free to ask for support tho. Although i have a way better code now.
BUT IF SOMEBBODY CAN HELP ME AND TELL ME HOW TO GET MECANIM TO WORK WITH TOUCH CONTROLLS, ILL MAKE THE CODE AVAILABLE FOR FREE AGAIN. I PROMISE THAT.
Could you please help me setting this up. I am getting an input error and my vehicle's controls don't get disabled, which means it keeps moving away when I try moving towards it :(
Dude! This works awsome thanks so much for the post! You are the man!
O$$anonymous$$AY PEOPLE ... YOU HAVE TO EDIT THE SCRIPT BY YOURSELF. WHERE STANDS "car"... you have to fill in you cars name. and in "drivingscript" you have to fill in the name of the driving script that is attached to your car. Its like an out of the box script for you so u dont have to script that much by yourself
@ the people who r having the problem that your character doesnt give a sh*t where you stand at.
ITS EXTRE$$anonymous$$LY I$$anonymous$$PORTANT THAT YOU ATTACH THE SCRIPTS ON THE TRIGGER BOXES and NOT on the player itself !!!AND SET THESE BOXES AS "is trigger" $$anonymous$$A$$anonymous$$E SUR YOU FILL OUT RIGHT INFOR$$anonymous$$ATION IN THE SCRIPT and $$anonymous$$ATCH THE RIGHT VARIABLES. *FOLLOW EACH STEP OF $$anonymous$$Y TUTORIAL. *SEARCH FOR OWN $$anonymous$$ISTA$$anonymous$$ES YOU COULD HAVE $$anonymous$$AD$$anonymous$$ *LOO$$anonymous$$ AT THE "$$anonymous$$NOWN ISSUES" SECTION ABOVE
*TAG YOU CHARACTER AS "PLAYER". AND YOUR CAR AS "VEHICLE"!!!!
I GAVE YOU THE EXACT SA$$anonymous$$E SCRIPT THAT I$$anonymous$$ USING $$anonymous$$YSELF SO I CAN GUARENTEE IT WILL WOR$$anonymous$$ IF YOU FOLLOW EACH STEP OF $$anonymous$$Y TUTORIAL :)
if your car wont stop driving... that is becuz of your "driving script" you have to modify your driving script so that you car will slow down after some time when not pressing the gas pedal button. my script is a car enter and exit script GTA style ;) and it is doing its job very well i think :)im the first one who actually made a working one.
currently im working on the animation section in the script so that your character will follow the car and enter with an animation :)
$$anonymous$$INE DOESNT WOR$$anonymous$$ I TOO$$anonymous$$ A YOUTUBE VIDEO TO SHOW YOU!! http://www.youtube.com/watch?v=QHH3ntkF-H0&feature=youtu.be
help please
Answer by by0log1c · Mar 08, 2011 at 12:19 AM
Here its me again with general answer. I won't code the whole thing, but try something along these lines and come back with your problems. If you don't need anything fancy, here's how you could order things:
- Player enter Car trigger => Player learn of car existence
- Player hit a key and a car is known => function enterCar
- Play animation?
- Destroy Player / Disable Renderer / Hide under terrain
- Give control to car > Enable Script / Set a boolean variable
- Move around
- Player hit a key = > function exitCar
- Take control off car
- Play animation?
- Instantiate Player back at the left of the car
- Give control back to player
Can't believe I wrote all this, scripting would've been just as long but then I'd have done all the work ;)
hey thx for this i got it now working halfways :) animations are not that important for now ill add them later as soon as i have created some XD ...
So my character is disabled and invisible on key hit (made use of your last answer to achieve this ) and parented to the trigger thats also parented to the car :)
but i cant figure out how to reverse the whole thing ... i mean unparent the character.
$$anonymous$$ay i show you my code im using now?
You can if there's something to look at :) . Otherwise, try someObject.transform.parent = null;
From this point, specific questions should be asked as such as this site is not for general programmation question or ordering scripts. Search Unify/Unity3DStudent/Unity Scripting Reference as much as you can, that's how we all learned, not so long ago.
Answer by strongme · Dec 26, 2011 at 10:21 PM
I created a video tutorial for the script's implementation. I didn't tag the 'car' to vehicle, tag it according to 'Yung Hustla'. This script works really good, good work bro!
First Video: http://www.youtube.com/watch?v=TKDxRhkja0c
Second Video: http://www.youtube.com/watch?v=Cc-bvOSsc-c
FIX*** You have to set is Player Visible" OFF in order to only enter the car if you hit the collider. That ist what the last two lines on the bottom on the script stand for.
check out the very easy to ndertand tutorial ive wrote for this in addition you can check out the youtube tuturial that "strongme" made for us :)
Answer by ifirt456 · Oct 17, 2012 at 12:29 AM
Hey my script says Assets/_Scripts/EnterExit.js(24,71): BCE0019: 'enabled' is not a member of 'UnityEngine.Component'. please help since I am only a modeler :)
@ifirt456 open scipt and changes in the script to enable and then go in unity and edit> projectsetting> input then change the number in size 19 to 21 and then change the name of the last two with "e" and "r", put "and" in the alt button negative and also another sun that you put "r" in the negative alt button ... I hope you will both help ;)
Answer by nedmunds · Jan 29, 2013 at 07:47 AM
make enabled active
I get the same thing : Assets/_Scripts/EnterExit.js(24,71): BCE0019: 'enabled' is not a member of 'UnityEngine.Component'
Then if I use active ins$$anonymous$$d I get :
Assets/CarEnterScript.js(39,67): BCW0012: WARNING: 'UnityEngine.Component.active' is obsolete. the active property is deprecated on components. Please use gameObject.active ins$$anonymous$$d. If you meant to enable / disable a single component use enabled ins$$anonymous$$d.
its a vicious circle lol then gameObject.active is Obsolete so its gameObject.SetActive then your back at is not a member of 'UnityEngine.Component'
going crazy !
Follow this Question
Related Questions
Enable and disabled parent contraint with c# 1 Answer
how to disable patent components incode 0 Answers
Enter\Exit Car With Doors. 0 Answers
enable/disable specific components 3 Answers
Disable a script from another script 2 Answers