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 xxluky · Mar 24, 2015 at 09:04 AM · 2dbackgroundscrolling

How to follow a game object by camera but with a slower speed?

Hi everybody,

I have a problem. I do not want to drag a game object onto a camera so it is followed by the camera. I want to use script for camera and follow the game object by camera but with slower speed. It is actualy for 2D background scrolling. The camera follows my player so it is not moving always.

please help.

Comment
Add comment · Show 11
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 Fattie · Mar 24, 2015 at 09:12 AM 0
Share

look to the many examples of, or just buy from the asset store, a "parallax" background. it's a standard thing for scrollers and you can easily find it

avatar image xxluky · Mar 24, 2015 at 09:28 AM 0
Share

Yeah, I was already looking on it but all free assets and online tips on background scrolling works on arrow keys. That is not what I want because my player can walk and simultaneously stay on one spot so scrolling is then unnatural. I need to pair it with the camera which the only one follows my player...

avatar image Fattie · Mar 24, 2015 at 09:31 AM 0
Share

you simply need to use a parallax scrolling background. and then decide, yourself, how you want it to move. for example if the "character animation of walking" makes the background move .. do that. from the animation just send a speed value to the parallax BG.

avatar image xxluky · Mar 24, 2015 at 09:58 AM 0
Share

As I sayed, my player can walk and simultaneously stay on one spot because of barriers. In this case, the player IS walking but DOES NOT move. When I do what you are saying, my player will not move but the background will move.

I need to use a script attached to my camera with public variable and make my background moving accordingly to my camera only on X axis but with a slower speed lets say 5f. How should I do it?

avatar image Digital-Phantom · Mar 24, 2015 at 11:47 AM 1
Share

So make it so that when your player collides with an object the walk animation finishes.

If the walk animation finishes then your background will stop moving.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by sujit11dec · Mar 24, 2015 at 06:15 PM

One Simple Solution is, use smoothFollow script on camera.

For that firstly import "scripts" unitypackge in your scene.

Then on camera add smoothfollow script using Add Component.

Then in smoothfollow script, there is a Target field.

In Target feild, assign gameobject that you want to followed by camera.

Alter other options from the script to match your requirement.

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 Ericool · Mar 24, 2015 at 05:07 PM

the easiest thing would be to translate the camera with a script using a certain speed and a box collider with the player to stop moving if OnTriggerEnter .

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

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

Related Questions

parallax scrolling background 2 Answers

Large finite background for vertical scroller - best approach? 1 Answer

Scrolling background help - seams appearing... 1 Answer

2D Infinite Vertical Background scrolling 0 Answers

Equally Distributing Light On a Quad Object 2D 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