# Mod API update 0.27.*

### Mod API update 0.27.*

Added methods for rotation.

es.Root.Rigidbody.Rotation = {x,y,z,w}

Quaternions are used to represent rotations.

They are compact, don’t suffer from gimbal lock and can easily be interpolated. Unity internally uses Quaternions to represent all rotations.

They are based on complex numbers and are not easy to understand intuitively. You almost never access or modify individual Quaternion components (x,y,z,w); most often you would just take existing rotations and use them to construct new rotations (e.g. to smoothly interpolate between two rotations). The Quaternion functions that you use 99% of the time are: Quaternion.LookRotation, Quaternion.Angle, Quaternion.Euler, Quaternion.Slerp, Quaternion.FromToRotation, and Quaternion.identity. (The other functions are only for exotic uses.)

es.Quaternion - stores methods for working with quaternions

es.Quaternion.Euler(float x, float y, float z)

Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis.

Quaternion es.Quaternion.LookRotation(Vector3 forward, Vector3 upwards = Vector3.up)

#### Description

Creates a rotation with the specified `forward`

and `upwards`

directions.

Z axis will be aligned with `forward`

, X axis aligned with cross product between `forward`

and `upwards`

, and Y axis aligned with cross product between Z and X.

Returns identity if `forward`

or `upwards`

magnitude is zero.

Returns identity if `forward`

and `upwards`

are colinear.

Quaternion es.Quaternion.FromToRotation(Vector3 fromDirection, Vector3 toDirection)

#### Description

Creates a rotation which rotates from `fromDirection`

to `toDirection`

.

Vector3 es.Quaternion.ToEulerAngles(Quaternion rotation)

#### Description

Returns the euler angle representation of the rotation.

A rotation that rotates euler.z degrees around the z axis, euler.x degrees around the x axis, and euler.y degrees around the y axis (in that order).

Quaternion es.Quaternion.Inverse(Quaternion rotation)

#### Description

Returns the Inverse of `rotation`

.

Quaternion es.Quaternion.Multiply(Quaternion a, Quaternion b)

#### Description

Multiplies two quaternions

Vector3 es.Quaternion.MultiplyByVector(Quaternion a, Vector3 vector)

#### Description

Multiplies quaternion by vector and returns vector. use it to rotate vector by rotation a

es.Root.Rigidbody.Rotation

#### Description

Sets or gets a rotation of this rigidbody (quaternion)

es.Root.Rigidbody.RotateAround(Vector3 point, Vector3 axis, float angle)

## Description

Rotates the transform about `axis`

passing through `point`

in world coordinates by `angle`

degrees.

This modifies both the position and the rotation of the transform.

Transform.Rotation

#### Description

Gets a rotation of transform (quaternion)

es.Root.Transform

#### Description

returns a transform of the root

void es.Root.Rigidbody.AddExplosionForce(float explosionForce, Vector3 explosionPosition, float explosionRadius, float upwardsModifier = 0.0f, int mode = 0));

## Parameters

explosionForce | The force of the explosion (which may be modified by distance). |

explosionPosition | The centre of the sphere within which the explosion has its effect. |

explosionRadius | The radius of the sphere within which the explosion has its effect. |

upwardsModifier | Adjustment to the apparent position of the explosion to make it seem to lift objects. |

mode | The method used to apply the force to its targets. |

//

// Summary:

// Add a continuous force to the rigidbody, using its mass.

Force = 0,

//

// Summary:

// Add an instant force impulse to the rigidbody, using its mass.

Impulse = 1,

//

// Summary:

// Add an instant velocity change to the rigidbody, ignoring its mass.

VelocityChange = 2,

//

// Summary:

// Add a continuous acceleration to the rigidbody, ignoring its mass.

Acceleration = 5

## Description

Applies a force to a rigidbody that simulates explosion effects.

The explosion is modelled as a sphere with a certain centre position and radius in world space; normally, anything outside the sphere is not affected by the explosion and the force decreases in proportion to distance from the centre. However, if a value of zero is passed for the radius then the full force will be applied regardless of how far the centre is from the rigidbody.

By default, the direction of the force is the line going from the explosion centre to the rigidbody’s centre of mass. If you pass a non-zero value for the `upwardsModifier`

parameter, the direction will be modified by subtracting that value from the Y component of the centre point. For example, if you pass a value of 2.0 for `upwardsModifier`

, the explosion will appear to be centred 2.0 units below its actual position for purposes of calculating the force direction (ie, the centre and the radius of effect are not modified). Using this parameter, you can easily make the explosion appear to throw objects up into the air, which often gives a more dramatic effect than a simple outward force.

#### Add a Comment

You must be logged in to post a comment.

Where and what estimated day can we get the update for the spring/suspension block?

Plis new update for the ios thanx!!’

New update for the ios!!

Add suspension and pistons plz