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
0
Question by AnnaMarsh · Apr 22, 2013 at 07:46 AM · cameramouselookorbitcharactermotor

FP Camera vertical orbit around "poles" of an object

Hello, I'm a new user of Unity and have done several tutorials on standard first person games, but am now trying to do something different. I'm using PC keyboard controls.

I'd like a first person controlled camera which is confined to orbit a specific object at the centre of the scene. I'd like the left/right arrow keys to make the camera orbit horizontally around the "equator" of the object and the up/down arrow keys to make the camera orbit vertically around the "poles". I thought the easiest way to do this would be to just copy and tweak the FPSInputController, CharacterMotor and MouseLook scripts.

I got the horizontal orbit really easily by changing the MouseLook script to this:

 public Transform targetLookAt;
     
     void Update()
     {
         transform.LookAt(targetLookAt);
     }  

But the vertical one is escaping me. I tried changing line 11 in the FPSInputController script to say this:

 var directionVector = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"),0);

Thinking that it would use the up/down arrow input for the Y axis, but it doesn't work, I'm guessing because with the standard CharacterMotor the Y axis is set by jumping (or falling).

I'm sure there's a much easier way to do this than I'm trying to do it, probaby by writing a script from scratch rather than trying to hack the FPS ones about. Any advice on the best way to tackle would be much 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 Fattie · Apr 22, 2013 at 07:49 AM 0
Share

there are many, many questions on here about "orbit", also di dyou try the "orbit" script freely supplied by Unity ? also try using google, "unity3D orbit script"

avatar image AnnaMarsh · Apr 22, 2013 at 07:59 AM 0
Share

I tried the $$anonymous$$ouseOrbit script but this just made the camera look around itself, not orbit the object. I also looked at lots of other questions on here with "orbit" in them & used a websearch but I didn't find something that I could understand. Sorry if its a dumb question but the FAQ does say its Ok to ask any questions :)

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

12 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

Related Questions

Camera position not updating 1 Answer

Mathf.Clamp is 'Sticky'? 1 Answer

Enable the OrbitCam script how can I make it will continue from the current camera view and position ? 0 Answers

Gyroscope Orbit Android 1 Answer

Mouselook in space, without a 'down' or 'up' 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