UNITY 5.2 Vector3 Structure

Source: Internet
Author: User
Tags float max string format unity 5
Static variables: Abbreviations for special vectors, read-onlypublic static Vector3 back {get;}
Description: Vector3 (0, 0,-1) abbreviation

public static Vector3 down {get;}
Description: Vector3 (0,-1, 0) abbreviation

public static Vector3 forward {get;}
Description: Vector3 (0, 0, 1) abbreviation

public static Vector3 left {get;}
Description: Vector3 (-1, 0, 0) abbreviation

public static Vector3 one {get;}
Description: Vector3 (1, 1, 1) abbreviation

public static Vector3 right {get;}
Description: Vector3 (1, 0, 0) abbreviation

public static Vector3 up {get;}
Description: Vector3 (0, 1, 0) abbreviation

public static Vector3 zero {get;}
Description: Vector3 (0, 0, 0) abbreviation

Constructor: default constructor is 0 vector
Public Vector3 (float x, float y);
Public Vector3 (float x, float y, float z);
Description: Pass in each coordinate value, default is 0, because the object is a value type because it is a struct

Public variables:Public float magnitude {get;}
Description: Returns the length of the vector, if only the comparison vector size should be used Sqrmagnitude

Public Vector3 normalized {get;}
Description: Returns the unit vector of a vector, returning a new vector without changing the vector value. If the vector is too small, it may return a 0 vector.

Public float sqrmagnitude {get;}
Description: Calculates the square of the vector length quickly, so the comparison vector size uses this property

Public float This[int index] {get; set;}
Description: Use the indexer to access x = [0],y = [1],Z = [2] Value

public float x;
public float y;
public float Z;
Description: The three coordinate values of the vector

Public function:public void Normalize ();
Description: The current vector will be normalized, changing the current vector's value, and substituting the attribute if you do not want to change it. If it's too small, return 0 vectors.
public void Set (float new_x, float new_y, float new_z);
Description: Sets the x, Y, z value of the vector that already exists
public void scale (Vector3 scale);
Description: Enlarges this vector by scale
public override string ToString ();
public string ToString (string format);
Description: Returns the string format of a vector

static function:public static float Angle (Vector3 from, Vector3 to);
Description: Gets the angle between two vectors [0, 180], without order
public static Vector3 clampmagnitude (Vector3 vector, float maxLength);
Description: Returns a vector of the same unit vector as the vector, with a size of maxLength
public static Vector3 Cross (Vector3 LHS, Vector3 RHS);
Description: Returns the normal vector of LHS x RHS, using the left hand rule
public static float Distance (Vector3 A, Vector3 b);
Description: Returns the distance of the A vector from the B vector. (A-B) magnitude
public static float Dot (Vector3 lhs, Vector3 RHS);
Description: Return LHS * RHS
public static Vector3 Lerp (Vector3 A, Vector3 B, float t);
public static Vector3 lerpunclamped (Vector3 A, Vector3 B, float t);
Description: A vector is inserted in Linear a B, and T [0,1] denotes [a, b]
Ublic static Vector3 Max (Vector3 lhs, Vector3 RHS);
public static Vector3 Min (Vector3 lhs, Vector3 RHS);
Description: A new vector consisting of the maximum (minimum) values in two vectors
public static Vector3 Movetowards (Vector3, Vector3 target, float maxdistancedelta);
Note: Move the current in the direction vector with target, no more than target Maxdistancedelta
public static Vector3 Normalize (Vector3 value);
Description: Returns the unit vector of value without changing value
public static void Orthonormalize (ref Vector3 Normal, ref Vector3 tangent);
public static void Orthonormalize (ref Vector3 Normal, ref Vector3 tangent, ref Vector3 binormal);
Description: The unit of normal, the tangent, and make him orthogonal with normal, the unit binormal, so that he with the front two orthogonal
public static Vector3 Project (Vector3 vector, Vector3 onnormal);
Description: Returns vector of vector projection in onnormal direction
public static Vector3 Projectonplane (Vector3 vector, Vector3 planenormal);
Description: Returns the vector of a vector projected on a plane perpendicular to the planenormal
public static Vector3 Reflect (Vector3 indirection, Vector3 innormal);
Description: Returns the reflection vector of the indirection in the orthogonal screen with Innormal
public static Vector3 Rotatetowards (Vector3, Vector3 target, float maxradiansdelta, float maxmagnitudedelta);
Description: Current to target rotates the maxradiansdelta angle, (Maxmagnitudedelta), and eventually current is at most the same or opposite target
public static Vector3 scale (Vector3 A, Vector3 b);
Description: Returns vector A with vector b zoomed-in vectors
public static Vector3 Slerp (Vector3 A, Vector3 B, float t);
public static Vector3 slerpunclamped (Vector3 A, Vector3 B, float t);
Description: Returns a vector between the angles of A and B, and T indicates which vector is biased
public static Vector3 Smoothdamp (Vector3 current, Vector3 target, ref Vector3 currentvelocity, float smoothtime);
public static Vector3 Smoothdamp (Vector3 current, Vector3 target, ref Vector3 currentvelocity, float smoothtime, float max Speed);
public static Vector3 Smoothdamp (Vector3 current, Vector3 target, ref Vector3 currentvelocity, float smoothtime, float max Speed, float deltatime);
Note: Gradually move a vector to the target location
Current: coordinates
Target: Destination coordinates
Currentvelocity: The speed at which each call to this function gets
Smoothtime: About the time spent, the smaller the value, the greater the speed
Maxspeed: Limit the maximum speed
Deltatime: Invokes the event interval, which defaults to Time.deltatime.

operator overloading is the same as Vector2
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.