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

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

(9911)

2D

(260)

Ads

(50)

AI & Navigation

(77)

Analytics

(115)

Animation

(366)

Asset Store

(271)

Assets

(510)

Audio

(169)

Cloud Build

(122)

Collaborate

(45)

Docs & Tutorials

(217)

Editor

(2293)

Everyplay

(13)

Game Performance Reporting

(16)

General

(890)

Graphics

(821)

GUI

(397)

Input

(157)

Licensing

(84)

Networking

(176)

Physics

(362)

Platforms

(427)

Profiling & Optimization

(76)

Runtime

(171)

Scripting

(1097)

Terrain

(164)

WebGL

(138)