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
1
Question by MK7 · Mar 29, 2011 at 08:31 AM · rotationz-axisfirst-person

z-axis Rotation

Okay; so I was looking at the unity script reference pages and I wanted to know how I would rotate an object on the z axis. I'm trying to achieve a sideways rotation (is roll a better word?) for a first person maze where you can rotate the level itself. the problem is that the C & V keys result in the object spinning as if I was using the mouse to spin myself in a circle.

var Player : Transform; var RotateSpeed = 20;

function Update () {

if (Input.GetKey ("z")) // spin the player around the world origin at 'RotateSpeed' degrees/second. transform.RotateAround (Player.position, Vector3.right, RotateSpeed Time.deltaTime); if (Input.GetKey ("x")) transform.RotateAround (Player.position, Vector3.left, RotateSpeed Time.deltaTime);

if (Input.GetKey ("c")) transform.RotateAround (Player.position, Vector3.down, RotateSpeed * Time.deltaTime);

if (Input.GetKey ("v")) transform.RotateAround (Player.position, Vector3.up,RotateSpeed * Time.deltaTime);

}

Comment
Add comment · Show 6
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 Meltdown · Mar 29, 2011 at 09:50 AM 2
Share

I'd suggest editing your post and placing your code correctly between the 'code' tags so people will be able to read your code easier, and be more willing to help :)

avatar image MK7 · Mar 29, 2011 at 01:33 PM 0
Share

whoops thought I did; 4am can do that to ya... :)

avatar image Justin Warner · Mar 29, 2011 at 01:34 PM 1
Share

=D He did it... O$$anonymous$$G, +1 to both of you! Haha... Checking the problem though =) 1 sec.

avatar image Justin Warner · Mar 29, 2011 at 01:38 PM 0
Share

So... Did you want the level to like... $$anonymous$$ind do a "Barrel Roll" over you? So like, the level will be upside down? Or am I reading this wrong? =)

avatar image Justin Warner · Mar 29, 2011 at 01:40 PM 0
Share

Oh, and if you do... the ZX keys are doing that for me...

Show more comments

2 Replies

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

Answer by poncho · Mar 29, 2011 at 02:15 PM

you can use transform.Rotate( Vector3 ) i use it to rotate objects so if your object is the whole map, i bet it will work

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 MK7 · Mar 29, 2011 at 02:43 PM 0
Share

Unfortunately, I can't do it that way; It cause all sorts of collision problems with the level.

avatar image
0
Best Answer

Answer by MK7 · Mar 29, 2011 at 09:33 PM

Figured it out: I used Vector3.forward & Vector3.back to achieve what I was looking for.

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.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

How to stop rotation in x and y axis??? 2 Answers

Rotation eulerangles not adjusting correctly... 2 Answers

controller 2 Answers

Rotate object like a safe dial 0 Answers

Unity Mouse Look Script Issue 0 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