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 Steven-1 · Aug 14, 2010 at 10:32 AM · charactercontrollerlookatnormalup

(CharacterController's) transform.Lookat not working as expected

I'm using the CharacterController (together with my own scripts) to control the player character.

I want to make the up-vector of the player to point in the same direction as the normal of the ground he's standing on, but for some reason that just won't work.

I've used the transform.Lookat() function for this, but it often seems to not do anything at all. So I'm wondering if the CharacterController perhaps alters it's upvector itself ?

cause even when I do a simple test like this:

newup = transform.forward*0.5 + transform.up*0.5;
newdir = Quaternion.FromToRotation ( transform.up, newup ) * transform.forward;
transform.LookAt( transform.position+newDir, newup );

it does nothing at all
transform.forward and transform.up are unchanged afterwards, instead of beeing equal to newdir and newup.

I've also tried rotating the player character, but this doesn't work correctly either

Any help ?

Comment
Add comment
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

1 Reply

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

Answer by Eric5h5 · Aug 14, 2010 at 10:37 AM

Character controllers always remain upright, and can only be rotated around the Y axis.

Comment
Add comment · Show 3 · 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 Steven-1 · Aug 14, 2010 at 10:40 AM 0
Share

great :s guess I can't use the Character controller then

thanks for the fast answer

avatar image Steven-1 · Aug 14, 2010 at 10:45 AM 0
Share

hm, that doesn't seem right do (about your answer) when I use the Rotate funtcion, the Character controller does rotate (but incorrectly) and the lookat function does somethimes rotate the upvector

avatar image Eric5h5 · Aug 14, 2010 at 06:36 PM 0
Share

@Steven: no, a character controller does not rotate, ever, except around the Y axis. If you look at the collider in the scene view, it is always upright.

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

No one has followed this question yet.

Related Questions

Proper Variation of this code, to work with any UP normal; 3 Answers

How can i detect the normal of the collider the Character Controller is touching. 2 Answers

my char is facing downwards 1 Answer

Please help me finish my 3rd person rigid body controller! 0 Answers

How can I move a character to a point in a straight line with CharacterController.Move while rotating him? 2 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