Struct amethyst_core::transform::components::Transform[][src]

pub struct Transform {
    pub rotation: Quaternion<f32>,
    pub scale: Vector3<f32>,
    pub translation: Vector3<f32>,
}

Local position, rotation, and scale (from parent if it exists).

Used for rendering position and orientation.

The transforms are preformed in this order: scale, then rotation, then translation.

Fields

Quaternion [w (scalar), x, y, z]

Scale vector [x, y, z]

Translation/position vector [x, y, z]

Methods

impl Transform
[src]

Important traits for &'a mut R

Makes the entity point towards position.

up says which direction the entity should be 'rolled' to once it is pointing at position. If up is parallel to the direction the entity is looking, the result will be garbage.

This function only works with respect to the coordinate system of its parent, so when used with an object that's not a sibling it will not do what you expect.

Examples

let mut t = Transform::default();
// No rotation by default
assert_eq!(t.rotation, Quaternion::one());
// look up with up pointing backwards
t.look_at(Point3::new(0.0, 1.0, 0.0), Vector3::new(0.0, 0.0, 1.0));
// our rotation should match the angle from straight ahead to straight up
let rotation = Quaternion::from_arc(
    Vector3::new(0.0, 0.0, -1.0),
    Vector3::new(0.0, 1.0, 0.0),
    None);
assert_eq!(t.rotation, rotation);

Returns the local object matrix for the transform.

Combined with the parent's GlobalTransform component it gives the global (or world) matrix for the current entity.

Convert this transform's rotation into an Orientation, guaranteed to be 3 unit orthogonal vectors

Important traits for &'a mut R

Move relatively to its current position.

Important traits for &'a mut R

Move relatively to its current position and orientation.

Equivalent to rotating the translation before applying.

Important traits for &'a mut R

Move a distance along an axis.

It will not move in the case where the axis is zero, for any distance.

Important traits for &'a mut R

Move a distance along an axis.

It will not move in the case where the axis is zero, for any distance.

Important traits for &'a mut R

Move forward relative to current position and orientation.

Important traits for &'a mut R

Move backward relative to current position and orientation.

Important traits for &'a mut R

Move right relative to current position and orientation.

Important traits for &'a mut R

Move left relative to current position and orientation.

Important traits for &'a mut R

Move up relative to current position and orientation.

Important traits for &'a mut R

Move down relative to current position and orientation.

Important traits for &'a mut R

Pitch relatively to the world.

Important traits for &'a mut R

Pitch relatively to its own rotation.

Important traits for &'a mut R

Yaw relatively to the world.

Important traits for &'a mut R

Yaw relatively to its own rotation.

Important traits for &'a mut R

Roll relatively to the world.

Important traits for &'a mut R

Roll relatively to its own rotation.

Important traits for &'a mut R

Rotate relatively to the world

Important traits for &'a mut R

Rotate relatively to the current orientation

Important traits for &'a mut R

Set the position.

Important traits for &'a mut R

Set the rotation using Euler x, y, z.

Arguments

  • x - The angle to apply around the x axis. Also known at the pitch.
  • y - The angle to apply around the y axis. Also known at the yaw.
  • z - The angle to apply around the z axis. Also known at the roll.

Calculates the inverse of this transform, which we need to render.

We can exploit the extra information we have to perform this inverse faster than O(n^3).

Trait Implementations

impl Clone for Transform
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Transform
[src]

Formats the value using the given formatter. Read more

impl PartialEq for Transform
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Default for Transform
[src]

The default transform does nothing when used to transform an entity.

impl Component for Transform
[src]

Associated storage type for this component.

impl CgTransform<Point3<f32>> for Transform
[src]

Create an identity transformation. That is, a transformation which does nothing. Read more

Create a transformation that rotates a vector to look at center from eye, using up for orientation. Read more

Transform a vector using this transform.

Inverse transform a vector using this transform

Transform a point using this transform.

Combine this transform with another, yielding a new transformation which has the effects of both. Read more

Create a transform that "un-does" this one.

Combine this transform with another, in-place.

impl CgTransform<Point2<f32>> for Transform
[src]

Create an identity transformation. That is, a transformation which does nothing. Read more

Create a transformation that rotates a vector to look at center from eye, using up for orientation. Read more

Transform a vector using this transform.

Inverse transform a vector using this transform

Transform a point using this transform.

Combine this transform with another, yielding a new transformation which has the effects of both. Read more

Create a transform that "un-does" this one.

Combine this transform with another, in-place.

Auto Trait Implementations

impl Send for Transform

impl Sync for Transform