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
1
Question by AngryOrange · Sep 07, 2012 at 11:12 AM · camerafollowsmooth

Camera Smooth Follow

alt textHi I have a problem with camera follow script. My scene is a "room". It's 3d iOs side Scroller. My character is starting to walk a long the room, but when I'am using camera follow script from Standard Assets user can see what is out side to room. I need camera to start follow when character is in the middle of iPhone screen and then when the room end's stop follow. What I should use? I was playing with offset but I need two different offsets. One from the beginning and another when room is going to the end. So maybe I need two collider's and when character trigger collider camera starts or stops follow him. How to make this follow but only in specific borders. I 'don't want to show what is outside the room.

camera.png (151.5 kB)
Comment
Add comment · Show 2
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 · Oct 16, 2012 at 04:02 PM 0
Share

great image

avatar image AngryOrange · Oct 16, 2012 at 04:06 PM 0
Share

he he I was trying do my best ...

2 Replies

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

Answer by zyzyx · Sep 10, 2012 at 03:48 PM

You can use Mathf.Clamp to clamp the position of your camera. Say you want to move your camera from -100 to 100 on the x-axis the code could look something like this (c#, not testet):

     void Update()
     {
         Vector3 vec3 = transform.position;
         vec3.x = Mathf.Clamp(vec3.x, -100, 100);
         transform.position = vec3;
     }



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 AngryOrange · Sep 10, 2012 at 03:50 PM 0
Share

Thank you zyzyx I will try this solution too..

avatar image
0

Answer by Anusha · Sep 07, 2012 at 11:21 AM

decrease the clipping planes in camera... decrease the 'Far' value until your camera shows only your room

Comment
Add comment · Show 8 · 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 AngryOrange · Sep 07, 2012 at 11:26 AM 0
Share

Hi Anusha and thank you for trying help. :) I can not decrease the Far value because I don't want to show whole room. It's long room and it's a side scrolling game. User discover whole room during , character walk.

avatar image Anusha · Sep 07, 2012 at 11:31 AM 0
Share

did you tried changing the normalised view port Rect values?

avatar image AngryOrange · Sep 07, 2012 at 11:41 AM 0
Share

Yes I was playing with this but I guess It's not what I want. I need to show left side of the room, character is on the left side of iPhone screen. Character is start walking when he is in the middle of the iPhone screen camera starts to follow him. When room ends camera stop following him and character is going to the left side of the screen.

avatar image Anusha · Sep 07, 2012 at 12:15 PM 0
Share

in unity camera script there is a mouse-orbit script.. in it the camera rotates according to the mouse drag.... there is a function called ClampAngle() used in it which restricts the rotation.... i think you could modify it to restrict the movement too.....

static float ClampAngle(float angle, float $$anonymous$$, float max) { if (angle < -360) { angle += 360; } if (angle > 360) { angle -= 360; } return $$anonymous$$athf.Clamp(angle, $$anonymous$$, max); }

avatar image AngryOrange · Sep 07, 2012 at 01:49 PM 0
Share

HI Once more thank you Anusha. I attached a png to show what I need. I don't need to touch any angle's

Show more comments

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

10 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

Related Questions

Camera follow smoothness problem 1 Answer

Smooth Follow Problem 1 Answer

Why does the camera smoothly follow in one direction but not the other? 0 Answers

[Closed] SmoothFollow trouble 0 Answers

Need help/advice with 2D Camera follow script. 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