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 /
  • Help Room /
avatar image
0
Question by chintan_shroff · Jan 12, 2017 at 06:36 AM · camera followcamera movement

Lerp Camera between 2 moving points on a defined path

Hi all, I have been really struggling with my camera movement and need some help! The whole square rotates clockwise around Point R when player presses the Right key The square can be rotated infinite amount of time and I want the camera to move as if it has gravity

if the square rotates 90 deg, cam moves from Point A to B (smoothly)

if the square rotates 270 deg, cam moves from Point B to A (smoothly)

Here is an image to explain better https://www.facebook.com/photo.php?fbid=10158179885810352&set=gm.1576462965749920&type=3&theater

I have already tried moveTowards but the camera goes completely wild and doesn't move in a straight line that I have defined.

 void MoveClockWise()
 {
 //this rotates the entire square
 mySquare.transform.RotateAround(R.position, new Vector3(0.0f, 0.0f, 1.0f), -100 * Time.deltaTime);

 //set the step, not sure if the calculation is correct :(
 float step = mySpeed*Time.deltaTime;
 //and move camera
  myCamera.transform.position = Vector3.MoveTowards(myCamera.transform.position, PointB.position, step);
 }
 

Any help would be appreciated. Thanks!

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 hexagonius · Jan 12, 2017 at 07:03 AM 0
Share

should the camera move from a to b during a 360 of the cube, or 90°? what does it do if the cube goes even further than that? is the cube restricted in rotation?

avatar image chintan_shroff hexagonius · Jan 12, 2017 at 07:24 AM 0
Share

@hexagonius the cube can be rotated infinite amount of time and the camera moves as if it has gravity

if the cube rotates 90 deg, cam moves from Point A to B

if the cube rotates 270 deg, cam moves from Point B to A

0 Replies

· Add your reply
  • Sort: 

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

87 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 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

How to fix player camera shaking 0 Answers

CineMachine Virtual Camera distance 0 Answers

Camera does not follow player properly 0 Answers

Make camera follow and look at object at the same time 0 Answers

How to set movement limit to Camera in a top-down 3D game 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