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 helloiam · Jan 19, 2013 at 06:34 PM · positionmovebackgroundz

How to make the background move for a nice effect.

I am making a game right now and I want that the background moves slowly to the left and it starts at these positions X -2.981993, Y -0.4566485, Z = 1. And it must goes slowly to these positions X -2.981993, Y -0.4566485, Z = -4. And when it does again the background clones or dissapear himself and then it goes again to these positions X -2.981993, Y -0.4566485, Z = 1. But when it does it must not be like that the player can see that this is happening :) I hope you are understanding it. So it's like background goes left slowly and then again it spawns on new position en it repeats itself. But I don't want that the background clones itself otherwise you will have 40 backgrounds and the game will be lagg hard.

PS: I am sorry for my bad English hope that you understand what I ment.

Thank in advance.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Wiki

Answer by simco500 · Jan 20, 2013 at 02:52 AM

It is really easy done by just scrolling the texture smoothly. Here is the code:

 var ScrollSpeed : float = 0.5;
 
 function Update () {
     var offset : float = Time.time * ScrollSpeed;
     renderer.material.SetTextureOffset ("_MainTex", Vector2(offset,0));
 }

Also explained HERE

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 helloiam · Jan 20, 2013 at 07:43 PM 0
Share

$$anonymous$$any thanks to simco500 it fixes my problem.

avatar image
0

Answer by robertbu · Jan 19, 2013 at 10:48 PM

Here is a starter script. Set the Start, End, and Distance to travel per second in the inspector:

 public class MoveSlowly : MonoBehaviour {
     public Vector3 v3StartPos;
     public Vector3 v3EndPos;
     public float fDistPerSecond = 0.1f;
     
     void Start () {
         transform.position = v3StartPos;
     }
     
     void Update () {
         transform.position = Vector3.MoveTowards(transform.position, v3EndPos, fDistPerSecond * Time.deltaTime);
         if ((v3EndPos - v3StartPos).magnitude < .000001f)
             transform.position = v3StartPos;
     }
 }
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
avatar image
0

Answer by helloiam · Jan 20, 2013 at 02:51 AM

I will try it, thanks. To the others post if you know better :D

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

12 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

Related Questions

How Can I Make The Parkour Moves Move Smoothly Instead Of Instantly Teleport? 1 Answer

move to a position not being looked at 1 Answer

move an object towards the touch or mouseclick position 2 Answers

Loop from Point A to Point B after Point C 2 Answers

Vector3.lerp doesn't work 1 Answer


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