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 /
avatar image
0
Question by shadowpuppet · Jun 04, 2015 at 02:12 PM · translate

stop an elevator

I have been monkeying around with the Stealth tutorial which ends with an elevator going up as the scene fades out. I commented out the scene ending stuff to see what happens and the elevator just keeps going. I have been all over the web trying to find a way to have it stop s o i can continue adding to the scene I built with the tutorial. None of the script functions I have found work. At best it snapped the elevator to that position and any script I came across with .Lerp in it unity told me it didn't exist or some such error. I simply want the elevator to stop after goinp up 4 floors so whatever that translates to in unity units ( a player is 2 so 8 or 10? ) anyway. move the elevator slowly ( like it is) but stop and unparent the player so I can get off. I don't know if you need the entire code but here is the part that I have been playing with at the end. I am having lots of fun with this but am stuck ( I managed to modify the enemyAttack script and apply to a health powerup).oh, as you can see I also commented out the camera movement being false so I could still follow the player ( as he snaps to a new location as it currently exists)

void LiftActivation () { // Increment the timer by the amount of time since the last frame. timer += Time.deltaTime;

     // If the timer is greater than the amount of time before the lift should start...
     if(timer >= timeToLiftStart)
     {
         // ... stop the player and the camera moving and parent the player to the lift.
         playerAnim.SetFloat(hash.speedFloat,0f);
         //camMovement.enabled = false;
         player.transform.parent = transform;
         
         // Move the lift upwards.
         //transform.Translate(Vector3.up * liftSpeed * Time.deltaTime);

         
         // If the audio clip isn't playing...
         if(!audio.isPlaying)
             // ... play the clip.
             audio.Play();
         
         // If the timer is greater than the amount of time before the level should end...
         //if(timer >= timeToEndLevel)
             // ... call the EndScene function.
         //    sceneFadeInOut.EndScene();
     }
 }

}

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rantor88 · Jun 04, 2015 at 02:54 PM

I looked through the internet and found a forum question where someone wanted to stop something from translating. They said that it would be better to define a boolean to dictate when it should stop moving. The question is here.

Anyways, you should try that and see if it stops the elevator, and modify the code to include what you have to do (Unparent the guy, play more music, etc.)

Comment
Add comment · 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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

[CANVAS] Coordinate transfer with scaling (pictures+details) 2 Answers

How to wait until player move to a specific position 0 Answers

How to destroy an object - destroy problems 3 Answers

How to translate an object correctly? 1 Answer

RigidBody clips into corners 3 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