"Unity_api Analysis" 13th, four chapters Vector2 class, Vector3 class

Source: Internet
Author: User
Tags in degrees instance method modulus

Vector2 class instance method

Normalize Method: Vector2 instance public void Normalize (), this method is used to unit the unit vector, will be Vector2 instances of the unit processing. This method changes the original vector with no return value. The instance property normalized is the same as this method, but the original vector value is not changed and there is a return value when the vector is normalized with the attribute.  vector2 class static method Angle method: Two vector angle public static float Angle (Vector2 from, Vector2 to); The parameter from is the starting vector and the to is the end vector. This method is used to return the angle of two Vector2 instances, in units of angle, the value of the return value range is [0,180], and the return value is 90 when at least one vector in from and to is Vector2.zero.  clampmagnitude method: Vector length public static Vector2 clampmagnitude (Vector2 vector, float maxLength); This method is used to return the length of the vector, And the maximum does not exceed maxlength.  lerp method: The vector difference public static Vector2 lerp (vector from, Vector2 to, float t), the parameter from is the starting vector of the interpolation, the parameter to is the interpolation end vector, the parameter T is the interpolation factor.  movetowards method: Vector difference public static Vector2 movetowards (Vector2 current, Vector2 target, float maxdistancedelta); The parameter current is the movement starting point coordinate, the parameter target is moving the target point, the parameter maxdistancedelta is the moving reference coefficient.  scale method: Vector indent public static Vector2 scale (Vector2 A, Vector2 b); This method is used to return the value of vector a after it is indented by Vector B, that is, the product of the vector, A, a.  vector3 class Instance property normalized property: unit vector public Vector3 normalized{get;} This property is used to get the unit vector of the Vector3 instance, that is, the direction of the return vector is the same as the original vector, and the die length becomes the 1. sqrmagnitude property: modulo length squaredpublic float Sqrmagnitude{get;} This property is used to return the square value of the Vector3 instance modulo length, which is the sum of three components squared.  vector3 class Instance method scale method: The vector shrinks the public void scale (Vector3 scale), which allows the Vector3 instance to be shrunk by the reference vector scale, that is, the components are multiplied sequentially.  vector3 class static method Angle method: Two vector angle public static float Angle (Vector3 from, Vector3 to); This method is used to return the angle of the vector from and to, in degrees, and the return value range is [ 0,180], and when at least one of the From and to is Vector3.zero, the method returns a value of 90.  clampmagnitude method: Vector length public static Vector3 clampmagnitude (Vector3 vector, float maxLength); This method is used to return a vector vector of vectors of the same direction, and the modulus length is limited by maxlength.  cross method: Vector fork by public static Vector3 cross (Vector3 Ihs,vecxtor3 RHS);  dot method: vector points multiply public static float Dot ( Vector3 Ihs, Vector3 RHS);  lerp method: Vector difference public static Vector3 Lerp (Vector3 from, Vector3 to, float t), parameter from is the difference starting point coordinate, parameter The number to is the interpolation end point coordinate, and the parameter T is the interpolation factor.  movetowards method: Vector difference public static Vector3 movetowards (Vector3 current, Vector3 target, float maxdistancedelta); This method is used to return a difference vector from the parameter current to the target of the parameter.  orthonormalize method: Two axes of orthogonal public static void Orthonormalize (ref Vector3 Normal, ref Vector3 tangent); This method is used for unit processing of the vector normal and for tanGent for orthogonal processing. That is, normal becomes the unit vector, and the tangent becomes a vector with a modulus of 1 perpendicular to the unit vector, and these vectors are in the same plane.  orthonormalize method: Three axes of orthogonal  public static void Orthonormalize (ref Vector3 Normal, ref Vector3 tangent, ref Vector3 binormal); This method is used for the unit processing of the vector normal, and the vector tangent and binormal are orthogonal processing, the above two parameters of the same overload, binormal perpendicular to the normal and tangent plane.  project method: Projection vector public static Vector3 project (Vector3 vector, Vector3 onnormal); This method is used to return vector vectors on vector onnormal.  reflect method: The reflection vector public static Vector3 Reflect (Vector3 indirection, Vector3 innormal), the parameter indirection into the amount, Innormal for mirror-oriented parameters The Innormal vector must be a unit vector, otherwise the incident angle and reflection angle are not equal. When the innormal is reversed, the reflection vectors are unaffected.  rotatetowards method: Spherical interpolation public static Vector3 Rotatetowards (Vector3 current, Vector3 target, float Maxradiansdelta, Float Maxmagnitudedelta) Parameter current is the starting point coordinates, the parameter target is the target point coordinate, the parameter maxradiansdelta is the angle rotation coefficient, the parameter maxmagnitudedelta is the modulus length coefficient.  scale method: The vector shrinks public static Vector3 scale (Vector3 A, Vector3 b); This method returns the product of vectors A and B.  slerp method: Spherical difference public static Vector3 Slerp (Vector3 from, Vector3 to, float t), parameter from is interpolated starting point coordinates, parameter to is interpolated end point coordinate,The parameter T is an interpolation factor. This method is used to return the spherical difference vector from the from point of the parameter to the to point of the parameter.  smoothdamp method: Damping motion public static Vector3 Smoothdamp (Vector3 current, Vector3 target, ref Vector3 currentvelocity, float smoothtime);p ublic static Vector3 Smoothdamp (Vector3 current, Vector3 target, ref Vector3 currentvelocity, float SMO Othtime, float maxspeed);p ublic static Vector3 Smoothdamp (Vector3 current, Vector3 target, ref Vector3 currentvelocity, FL Oat Smoothtime, float maxspeed, float maxspeed), where the parameter current is the start coordinate, the parameter target is the end coordinate, the parameter currentvelocity is the motion vector of the present frame, Parameter smoothtime is close to the target when the damping strength, the parameter maxspeed is the maximum movement speed, the default value is infinity, the parameter deltatime to control the actual movement of the current frame distance, that is, Maxspeed*deltatime, The default value is Time.deltatime.

"Unity_api Analysis" 13th, four chapters Vector2 class, Vector3 class

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.