Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 zero_null · Jan 03, 2018 at 10:34 AM · player movementcamera movementparallax

Move Camera is an order so that the background doesn't move fast

I have created a game where I am moving my player on a platform. The car moves fine on the platform and the camera follows the car as well. My problem is that I wanted my background to move slowly. I am using a perspective camera and I am moving camera away to create a zoom out effect when my player jumps. Do you suggest I should move my background towards right so that it creates a simple slow effect? As currently it moves very fast.

here is my video demonstration : https://www.youtube.com/watch?v=xO_mEXo6mNA

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
1
Best Answer

Answer by INvalidSauce · Jan 03, 2018 at 12:48 PM

If your background, is just a gameobject that is actually in the scene, you could just move it further away from the camera, and scale it up. It's a simple perspective change. The further away something is, the less paralax movement it presents when the camera moves.

Comment
Add comment · Show 5 · 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 zero_null · Jan 03, 2018 at 12:52 PM 0
Share

I have tried it and I came to know that moving away and scaling actually cancel out each other's effect. Let say size of $$anonymous$$e was 6 , It was at 20 units away from camera I increased size and now it's 12, I move it at 40 units. It will essentially look the same ? Isn't it ???

avatar image INvalidSauce zero_null · Jan 03, 2018 at 01:01 PM 1
Share

It will not work, if your camera is orthographic, as that removes perspective. Your camera must be a perspective camera, which you wrote it was. If it is, it will work.

avatar image OneCept-Games INvalidSauce · Jan 03, 2018 at 01:04 PM 0
Share

Still it would better to use parallax scrolling

Show more comments
avatar image
2

Answer by leSamo · Jan 03, 2018 at 10:57 AM

I don't know how your camera script works, but if you want smooth motion use:

 // SupposedCameraPositionVector is a Vector3 which is where the camera is supposed to be in a new frame according to your current calculations
 // modifier is a float, which decides how swiftly you want your camera to follow your car (I'd recommend setting it to something like 30f, but you can fiddle about with it and see what works for you)
 private void Update() {
     Vector3.Lerp(Camera.transform.position, SupposedCameraPositionVector, Time.deltaTime * modifier);
 }

If you don't know what Vector3.Lerp does then go here: https://docs.unity3d.com/ScriptReference/Vector3.Lerp.html

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 zero_null · Jan 03, 2018 at 12:16 PM 0
Share

I have tried Lerp but the issue is that I just can't make my background move slow.

avatar image
1

Answer by OneCept-Games · Jan 03, 2018 at 10:56 AM

In 2D scrolling games often Parallax scrolling is used. The main point is to keep all backgrounds in same Z coordinate in layers and move them with a factor between 0 and 1 according to the Camera in the opposite direction (x,y).

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 OneCept-Games · Jan 03, 2018 at 10:58 AM 0
Share

https://unity3d.com/learn/tutorials/topics/2d-game-creation/2d-scrolling-backgrounds

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

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

Related Questions

SOLVED ROTATE PLAYER ACORDING TO CAMERA ROTATION (using cinemacine and custom cameras) (player direction relative to camera) 0 Answers

Using Camera Y Rotation to Determine Player Movement Direction 0 Answers

Creating a file that records the player position during a game in xyz coordinates 0 Answers

How do I make my cameras parent follow my player? 0 Answers

"Rotating" the player's movement direction 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