• 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 BigText · Apr 19, 2014 at 12:58 AM · cameramouselookspacecamera-lookspaceship

Mouselook in space, without a 'down' or 'up'

I'm planning to make a game that allows you to fly around in outer space, and it's important for the 'space' feel that there is no 'down' or 'up'. For example, in a standard FPS on the ground, when you look all the way up, your character can't look up any further. On top of that, if you move the mouse to the side, your character spins around but is still aiming at the same point, directly above him.

I need to make a camera that, even if you're looking straight 'up' from the original orientation, moving the mouse to the left makes your aim move to the left exactly the same way as if you were turning left while aiming at the horizon in a standard FPS. This would result in your view of the "world" (outer space) becoming tilted, but that's the point. Also, there shouldn't be anything stopping the camera from tilting 'up' so far that it flips over altogether.

Can anyone give me advice on how to implement such a camera?

Comment
Add comment · Show 1
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 robertbu · Apr 19, 2014 at 01:24 AM 0
Share

With an arbitrary frame of reference, you will have a real problem making the movements be intuitive. For example say you don't play any limits so that there is nothing stopping the camera from flipping over. As the camera rotates over the top, your movements become reversed. That is, code moving your cursor up, now moves the camera down. For most situations, this is really disconcerting for users, and it may not be easily fixed.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by grahnzz · Apr 19, 2014 at 01:53 AM

reference the local axes instead of world

 //rotate around local y.
 this.transform.Rotate(Vector3.up,Input.GetAxis("Mouse X"),Space.Self);
 //rotate around local x;
 this.transform.Rotate(Vector3.right,-Input.GetAxis("Mouse Y"),Space.Self);

feels pretty weird

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

22 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

Related Questions

First Person Camera switch to Third Person Camera on Object 2 Answers

Why wont my camera controller work,Why isnt my script working for a camera controller? 1 Answer

how to: get second camera view out of maincam view ? 0 Answers

Constant 3D rotation (torque, angular acceleration, etc) GLOBAL to object in space? 1 Answer

unity3d quaternion slerp is off target 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges