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 BBrown4 · Feb 22, 2013 at 07:22 AM · c#first personlooking

Looking around without the entire body moving?

Well the question may be a little vague so let me clarify. My team and I are getting ready to work on a new game after having to put an older one on hold for a bit until things get sorted out. So I began running some tests in the editor, using the character controller assets, specifically the MouseLook, CharacterMovement, and FPSInputController. Now I've played around with first person before. I plan on writing my own scripts for first person, but I would like to know about how looking around actually works. I threw down a capsule, put the camera in it, assigned the scripts to the necessary objects and got it all working. Of course I did, they are pre written and work like a charm for simple tests. Now what puzzles me and I can't seem to figure out, is to prevent, when looking down, the entire capsule, or character model, from rotating it's entire body to look at the ground while not compromising it's ability to run in the direction the camera is facing. I've done some tests but to no avail. The best I could do was most likely obvious. Assign the mouse look scripts to something else, such as the camera alone, but obviously that would allow for you to look in any direction, but not move in that direction, as the Character is not facing that direction, just the camera, or so called head, (sphere).

TL:DR I need to be able to allow my capsule/character to be able to look down, without the entire body rotating and becoming horizontal, while not compromising the ability to move in the direction you are facing.

P.S I use C# if anyone has any code. I am not asking for someone to write code for me, I am simply asking how I would go about achieving what I have described.

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 Fattie · Feb 22, 2013 at 07:53 AM 0
Share

just FYI if you are new, you are familiar with the "LookAt" command? see docs

1 Reply

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

Answer by LukaKotar · Feb 22, 2013 at 11:05 AM

The camera needs to be able to rotate up and down, and the whole character should rotate left and right. The mouse look script from standard assets should be a good example to how it should be written.

Put the script on the root of the character, and select 'Mouse X' from the menu in the inspector. Do the same for the camera, except set it to 'Mouse Y'.

That should be it.

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 BBrown4 · Feb 22, 2013 at 07:25 PM 0
Share

Oh how could I be so blind?!?! Haha, that's great! thank you very very much for helping out! And while I didn't do it myself, I accidentally stumbled across the Prefab in the Character controller assets package. But had I tried it, it would have worked so thank you. Now comes the fun part, re-writing it in C# :D lol

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

11 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

Related Questions

Multiple Cars not working 1 Answer

C# Scripts don't work in Unity 3.5 any idea why? 1 Answer

C# Coding error 1 Answer

MonoDevelop Resizing 1 Answer

c# if function not finding anything to call 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