Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by Nosmo · Sep 08, 2016 at 07:10 PM · cameracamera-movementplayer movementsmoothsmoothfollow

How to make camera follow player from point to point

I'm trying to write a script that follows the camera to different areas in the game but while it is in that area the camera is stationary.

public Transform target; public float smoothing = 2f;

 Vector3 offset; /

 // Use this for initialization
 void Start () {
     offset = transform.position - target.transform.position; 
 }
 void FixedUpdate (){ 
     Vector3 targetCamPos = target.position + offset;
     transform.position = Vector3.Lerp (transform.position, targetCamPos, smoothing * Time.deltaTime);
 }

I want to make it smoothly transition between the 2 points and Smoothing * time.deltatime takes care of that but its keeping the camera still while the character is in the area that im having trouble with

Also pause the character movement until the camera reaches its position

Do you have any suggestions?

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

Answer by ArturoSR · Sep 08, 2016 at 08:01 PM

Hello there.

OK, you need to store the position point, then, after has been moved check if the camera position is the same as the desired point, your function still try to move it because there is nothing to tells it to not keep doing it, so, this way you can control more precisely the behavior of your camera, even you can add some interruption if your character changes his destination at certain event, cheers.

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 SoraMahiro · Sep 08, 2016 at 10:07 PM

I dunno if this helps, but what I did for a camera follow was I paired a camera to the player and set it for a display(for you this would depend on if the camera following is the main feed, if so check the display on the camera to 1) and then created a second camera, being the "Main camera" and set it to display 2. Also with the camera on player, turn off its audio listener or unity will complain about there being two audio listeners in the same scene. So what this did was allowed me to have a camera following my character and displaying in the game view, while having a secondary "Main camera" that picked up audio and could be used for a loading screen or a level over GUI, or a death GUI. It will also be smooth as long as your character motion is smooth.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

My camera is not smoothly following my character 1 Answer

How to have your player controls change while your camera rotates? 0 Answers

I build a own game but i have a cam problem 0 Answers

Camera flickers while chasing the player 0 Answers

Making a Smooth camera zoom with transform.Translate 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