Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jan 22, 2013 at 05:23 AM by Loius for the following reason:

Duplicate Question

avatar image
0
Question by LeoL274 · Jan 20, 2013 at 09:09 AM · vehicleexitenterfirst person

How to make an Enterable/Exitable Vehicle

Hi, I'm kinda new to Unity and I was wondering if it's possible to make it that when a First Person Controller collides with an object (vehicle in this case) that it will print on the screen "Press E To Drive Vehicle" then you will change to third person and be able to drive the vehicle then press E again to exit it.

I know it's a lot to ask, but please do your best to answer!

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Loius · Jan 22, 2013 at 05:23 AM 1
Share

please, please, please, conduct a simple search before you ask this

just click on the vehicle tag in your question, even, and half of those questions are 'please make me an enterable/exitable vehicle'

avatar image LeoL274 · Jan 22, 2013 at 11:18 PM 0
Share

Its just that none of the others work in my situation.

avatar image iwaldrop · Jan 22, 2013 at 11:20 PM 0
Share

It's your job as a programmer to solve problems. You shouldn't expect to go online and find a solution for every one of them. Think things through and write some code. Then, if it doesn't work, come here and post the parts that don't work and ask specific questions.

1 Reply

  • Sort: 
avatar image
1

Answer by Vonni · Jan 20, 2013 at 03:33 PM

  1. Make a Cube

  2. Remove Mesh renderer

  3. Scale and move to fit around your car (but bigger)

  4. Check the target box on collider

  5. Make a new Javascript

  6. Add:

      function OnTriggerEnter (other : Collider) {
             if(other.gameObject.equals("Player")){
                // Show text!
             }
         }
         function OnTriggerExit (other : Collider) {
             if(other.gameObject.equals("Player")){
                 // Hide Text!
             }
         }
         function OnTriggerStay (other : Collider) {
             if(Input.GetKeyDown(KeyCode.E))){
                 // Enter vehicle
             }
         }
    
    
  7. And the rest depends on how your game is and is for you to find out! :)

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LeoL274 · Jan 22, 2013 at 04:35 AM 0
Share

I have a problem with this, I keep getting a $$anonymous$$issing$$anonymous$$ethodException: UnityEngine.GameObject.equals not found and it always prints "Press E To Drive Car" even before I have collided with it, please help!

avatar image iwaldrop · Jan 22, 2013 at 05:51 AM 0
Share

Try changing

 if (other.gameObject.equals("Player"))

to

 if (other.gameObject.name == "Player")

Besides the fact that 'gameObject.equals()' doesn't exist (it's 'gameObject.Equals()' ftw), that function tests whether two objects are the same. And, for future reference, going to Google and typing 'Unity GameObject.Equals' will tell you all about it. Additionally, highlighting code and hitting command/ctrl+' (apostrophe) in $$anonymous$$onoDevelop will take you directly to the docs.

avatar image Shebi123 · Dec 04, 2015 at 12:27 PM 0
Share

where i place this script?car or Character?

avatar image Shebi123 · Dec 04, 2015 at 12:28 PM 0
Share

can you give me the full script of character and car?i have no knowledge about java.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Enter/Exit vehicle 0 Answers

Car Enter/Exit Script Multiple Cars Problem 4 Answers

Problem Enter and Exit with Vehicle 2 Answers

How do you make character enter and exit vehicles. 1 Answer

Enter\Exit Car With Doors. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges