Trait gdnative_core::core_types::vector2::Vector2Godot[][src]

pub trait Vector2Godot {
    fn aspect(self) -> f32;
fn cubic_interpolate(
        self,
        b: Self,
        pre_a: Self,
        post_b: Self,
        t: f32
    ) -> Self;
fn rotated(self, angle: Angle) -> Self;
fn slide(self, normal: Self) -> Self;
fn snapped(self, by: Self) -> Self;
fn tangent(self) -> Self;
fn move_towards(self, to: Vector2, delta: f32) -> Self;
fn direction_to(self, other: Vector2) -> Vector2;
fn distance_to(self, other: Vector2) -> f32;
fn distance_squared_to(self, other: Vector2) -> f32;
fn clamped(self, length: f32) -> Self; }

Helper methods for Vector2.

Trait used to provide additional methods that are equivalent to Godot's methods. See the official Godot documentation.

Required methods

fn aspect(self) -> f32[src]

Returns the ratio of x to y.

fn cubic_interpolate(self, b: Self, pre_a: Self, post_b: Self, t: f32) -> Self[src]

Cubicly interpolates between this vector and b using pre_a and post_b as handles, and returns the result at position t. t is in the range of 0.0 - 1.0, representing the amount of interpolation.

fn rotated(self, angle: Angle) -> Self[src]

Returns the vector rotated by angle radians.

fn slide(self, normal: Self) -> Self[src]

Returns the component of the vector along a plane defined by the given normal.

fn snapped(self, by: Self) -> Self[src]

Returns the vector snapped to a grid with the given size.

fn tangent(self) -> Self[src]

Returns a perpendicular vector.

fn move_towards(self, to: Vector2, delta: f32) -> Self[src]

Returns self moved towards to by the distance delta, clamped by to.

fn direction_to(self, other: Vector2) -> Vector2[src]

Returns the normalized vector pointing from this vector to other.

fn distance_to(self, other: Vector2) -> f32[src]

Returns the distance to other.

fn distance_squared_to(self, other: Vector2) -> f32[src]

Returns the squared distance to other.

This method runs faster than distance_to, so prefer it if you need to compare vectors or need the squared distance for some formula.

fn clamped(self, length: f32) -> Self[src]

Returns the vector with a maximum length by limiting its length to length.

Loading content...

Implementors

impl Vector2Godot for Vector2[src]

Loading content...