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 Hordaland · May 01, 2012 at 06:51 PM · rotationtransformdirection

Rotate the player toward a direction

Maybe there's a similar question out there but I can't find it. I want my fps character to be turned toward a specific direction. The problem is that every code I've found that seems to do that always resets my character to the original rotation.

For example I have a teleporter that teleports the character to another room. After the teleportation I want him to face a certain direction. But he's just turned a single frame and then turns back to the direction he was looking in when stepping into the first teleporter.

I'm just using a function like this and it seems to work that one frame but then just reverts back.

 function Teleport()
 {
      this.transform.rotation.y = 0.1;
 }

I also have no clue why the degrees don't match the number after the "y =" but that's not the main issue.

Thanks.

Comment
Add comment · Show 4
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 asafsitner · May 01, 2012 at 07:07 PM 1
Share

Is something overriding the player's rotation?

This code looks like it should work, so perhaps the problem is elsewhere?

avatar image Hordaland · May 01, 2012 at 07:29 PM 0
Share

Hm, that might be the issue. I tried to turn a table using the same code now and that seems to rotate it permanently. I can't seem to find the reason for why it won't work on the FPS controller though.

avatar image Befall · May 01, 2012 at 08:02 PM 0
Share

It's possible that in the controller it's using a specific value that is kept to define which direction the player is looking, so after you manually set it once, it still has the turn value and sets it back?

avatar image Hordaland · May 01, 2012 at 09:20 PM 0
Share

Seems to be the case. I'll have to look into that. Thanks for the tip.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to rotate instantated prefab without rotating it's local directions by javascript? 1 Answer

rotation relative to a transform 1 Answer

Moving an object with dependency of it's rotation 1 Answer

Problem with Shooting Accuracy 0 Answers

Bouncing Ball Problem( bounces vertically forever) 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