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 illbleedAlive · Apr 24, 2014 at 06:53 PM · transformtranslatemovingsimpleplatforms

Make simple moving platform

I've looked this previously, but i can't figure out how to make a platform move a few seconds, stop, then go back. I'm using UnityScript.

What i'm using right now is

 function Start () 
 {
 
 
 }
 
 function Update () 
 {
     transform.Translate(Vector3.forward * Time.deltaTime);
 }

This only makes it move forward without stopping or returning. I appreciate anyone taking the time to answer.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by tanoshimi · Apr 24, 2014 at 06:53 PM

Mathf.PingPong is your friend...

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 illbleedAlive · Apr 24, 2014 at 07:28 PM 0
Share

Thanks i seen something like this previously but wasn't sure if it would work. I'll give it a shot.

avatar image illbleedAlive · Apr 24, 2014 at 10:04 PM 0
Share

I did this and the platform goes off of the screen any explanation why it does this?

avatar image sgtstrings · Apr 24, 2014 at 10:21 PM 0
Share

Are you using it with translate or by setting the position (transform.position = ...)?

avatar image tanoshimi · Apr 25, 2014 at 05:46 AM 0
Share

Yes - you set the length variable too high. Change the 3 to a 1.

avatar image
1

Answer by sgtstrings · Apr 24, 2014 at 07:10 PM

I think you want to use a Sine or Cosine function. (I personally script in C#, but I assume it's similar to this)

 transform.Translate(transform.forward*Mathf.Cos (Time.time)*Time.deltaTime);
Comment
Add comment · Show 1 · 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 illbleedAlive · Apr 24, 2014 at 07:28 PM 0
Share

Thank you for your comment, i have to use unityscript as its for an assignment :].

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

22 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to transform global position of an object 1 Answer

Different between transform.Translate() and Vector3.MoveTowards? 1 Answer

move enemy to random transform array 2 Answers

Moving an object towards a clicked object 1 Answer

Moving objects when timescale is high, which .time to use ? 2 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