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 ltrout1999 · Apr 07, 2016 at 03:59 AM · cameracamera-movementcamera rotation

Having camera point and shift around origin?

I'm creating a game that is played on a plane that is separated into four quadrants. I want a to only look at one quadrant at each time with the rotation (35, 45, 0). Is there anyway to have the camera rotate around a point (most likely origin in this case) to the next defined location (aka, the next quadrant) instead of switching cameras? I feel like having the camera rotate at a speedy, but smooth, pace will keep gameplay flowing perfectly as this is going to be a quick-styled game.

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 ltrout1999 · Apr 07, 2016 at 04:05 AM 0
Share

@ZefanS maybe you know?

avatar image ltrout1999 · Apr 07, 2016 at 04:18 AM 0
Share

Just to clarify my question. I don't want to rotate the camera in its spot, I would like to have the camera move from (-79, 50, -79) to (79, 50, 79) (etc) but ins$$anonymous$$d of just zapping to the spot, I want it to rotate from the first spot to the second spot. Is this possible? Hopefully I am explaining this well enough; if not just say so and I will create a quick photo explaining better.

1 Reply

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

Answer by nisovin · Apr 07, 2016 at 05:21 AM

Create an empty game object and make it the parent of the camera. Put that empty game object at the origin, and have the camera at the correct position looking at the origin. Now when you rotate the empty game object, the camera will rotate around that spot.

You can use Quaternion.RotateTowards if you want to smoothly rotate the camera over time.

http://docs.unity3d.com/ScriptReference/Quaternion.RotateTowards.html

Comment
Add comment · Show 9 · 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 ltrout1999 · Apr 07, 2016 at 03:06 PM 0
Share

I'll test this later and report back. It seems there's always a pretty easy solution to my problems. I need to start thinking outside of the box. Thank you!

avatar image ltrout1999 · Apr 07, 2016 at 06:01 PM 0
Share

How would you suggest setting it up to where it would stop at a certain point? Right now the camera position to look at quadrant 1 would be (-80, 55, -80) rotated (37.5, 45, 0). To go to quadrant 2, it would be (80, 55, -80) rotate (37.5, -45, 0). How could I rotate from the first position to the second position?

avatar image nisovin ltrout1999 · Apr 07, 2016 at 07:48 PM 0
Share

Just use that function I gave you. You just need the target rotation.

Your other option here is to just set up game objects that already have the positions and rotations you want. Then you can use Quaternion.RotateTowards and Vector3.$$anonymous$$oveTowards to adjust the camera to those predefined positions.

avatar image ltrout1999 nisovin · Apr 07, 2016 at 07:50 PM 0
Share

On that function it asks for from, to, and maxDegrees. I'm not sure what to put for from and to, to make it go to the second position?

Show more comments
Show more comments
avatar image nisovin ltrout1999 · Apr 07, 2016 at 08:04 PM 0
Share

At some point you have to just try it and see. If you've set it up the way I told you, I suspect your numbers are wrong, since you should be rotation the game object, not the camera. But you can't know without trying. I've given you all of the information you need, I can't really do much else without creating your game for you.

I actually recommend now that you just take my second suggestion of setting up objects that already have the positions and rotations you want, and use their rotations/positions in your script rather than inputting the numbers directly.

avatar image ltrout1999 nisovin · Apr 07, 2016 at 08:11 PM 0
Share

Okay I seem to have it setup. I didn't realize I had to create another gameobject change the rotation and yeah. Thank you.

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

51 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

Related Questions

Can you offset the dead zone of Cinemachine's camera from the center? 0 Answers

I need to find a way to pan my camera around an object. 1 Answer

Camera gets stuck when cursor is locked 0 Answers

How to rotate the camera with the player smoothly without the camera snapping back and forth? 2 Answers

How to orbit camera around player from top-down to sidescroller view? 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