Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 idcanu · May 10, 2018 at 08:21 AM · scripting problemtransformscrpting

Problem in EulerAngles Understanding ??,EulerAngles.x is not exceeding -90 to 90 range??

Vector3 v;

void Start ()

{

      v = Vector3.zero;

}

void Update ()

{

     _xRotation = Mathf.Lerp(_xRotation, 0, _lerpRate);
     _yYRotation = Mathf.Lerp(_yYRotation, 0, _lerpRate);
     v.x += _yYRotation;
     v.y += _xRotation;
     v.z += 1 * Time.deltaTime;
     transform.eulerAngles = v;


// Above code ***

     transform.eulerAngles += new Vector3(0, _xRotation, -_yYRotation);

}

Hello friends, I am a beginner in unity and also please forgive my spelling mistake or grammatical mistake in the question.
Actually i am trying to orbit the camera around the player and i have problem in understanding in eulerAngles because when i use code above comment line the camera rotate in 360 angle but when i use code below the comment line the camera rotates only in 180 degree for x axis and for y axis it rotate 360 angle same value same code for x and y value but still this weird behavior. i am guessing this happen because " vector3 v" Declared ones in code above comment line and and in code below comment line every time it register new vector3 m i correct?? please explain.

note : code below is in comment written just for understanding

thank you in advance.

Comment
Add comment · Show 2
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 Nomenokes · May 10, 2018 at 11:38 AM 1
Share

Your code isn't formatted, probably an accidental mistake. It's just very difficult to read, so please edit.

avatar image idcanu Nomenokes · May 16, 2018 at 10:11 AM 0
Share

Check now is it okay actually i am new so i don't know how to post formatted question

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Happeloy · May 16, 2018 at 10:22 AM

A less confusing way to rotate an object than to edit its euler angles is to use the transform.Rotate(Vector3 angle).

 using UnityEngine;
 
 public class ExampleClass : MonoBehaviour
 {
     void Update()
     {
         // Rotate the object around its local X axis at 1 degree per second
         transform.Rotate(Vector3.right * Time.deltaTime);
 
         // ...also rotate around the World's Y axis
         transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
     }
 }

(Read more here: https://docs.unity3d.com/ScriptReference/Transform.Rotate.html)

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 idcanu · May 23, 2018 at 04:21 AM 0
Share

thank you for reply but my concern is not to rotate the object but to understand how eulerAngle works and why it cant exceed 90 degreee in above code thank you

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

160 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to change the direction of the RayCast? 2 Answers

Is it possible to intercept variable alteration/function calls on an object (From within the object)? 0 Answers

Transforming a GameObject with an unattached script 1 Answer

how to rotate and transform an Game object using same button in unity ? 0 Answers

does not want to work MoveTowards 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