Search Feedback

1
votes

Don't use Vector3 for Quaternion.eulerAngles

Scripting

-

-

Use a special struct for that purpose, like this:

struct EulerAngles
{
public float xRotaion;
public float yRotation;
public float zRotation;
}

Sometimes it leads to confusuin when you get a Vector3 from quaternion and try to pass it to another method that accepts direction vector (Debug.DrawRay, for example).

One can forget, that this "vector" is not a vector, but just a structure for rotation that looks very similar to vector.

In short:
Quaternion.eulerAngles == rotation
Vector3 != rotation

Comments (1)

  1. E5c7d8e9733ac6dee89d29d0cd0123f4?d=mm

    D43DB33F

    Jun 01, 2018 22:35

    And then a third one to separate degrees from radians ? Seems to me like it would be adding complexity for very small benefits, if any.

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(10511)

2D

(274)

Ads

(52)

AI & Navigation

(78)

Analytics

(125)

Animation

(389)

Asset Store

(330)

Asset Store Publisher

(10)

Assets

(534)

Audio

(176)

Cloud Build

(139)

Collaborate

(57)

Docs & Tutorials

(237)

Editor

(2450)

Everyplay

(14)

Game Performance Reporting

(15)

General

(950)

Graphics

(861)

GUI

(422)

Input

(165)

Licensing

(88)

Networking

(185)

Physics

(380)

Platforms

(438)

Profiling & Optimization

(81)

Runtime

(180)

Scripting

(1146)

Terrain

(168)

WebGL

(141)