Trait gdnative::core_types::vector2::Vector2Godot [−][src]
Helper methods for Vector2
.
Trait used to provide additional methods that are equivalent to Godot's methods.
See the official Godot documentation
.
Required methods
pub fn aspect(self) -> f32
[src]
Returns the ratio of x to y.
pub fn cubic_interpolate(
self,
b: Self,
pre_a: Self,
post_b: Self,
t: f32
) -> Self
[src]
self,
b: Self,
pre_a: Self,
post_b: Self,
t: f32
) -> Self
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.
pub fn rotated(self, angle: Angle<f32>) -> Self
[src]
Returns the vector rotated by angle
radians.
pub fn slide(self, normal: Self) -> Self
[src]
Returns the component of the vector along a plane defined by the given normal.
pub fn snapped(self, by: Self) -> Self
[src]
Returns the vector snapped to a grid with the given size.
pub fn tangent(self) -> Self
[src]
Returns a perpendicular vector.
pub fn move_towards(self, to: Vector2D<f32, UnknownUnit>, delta: f32) -> Self
[src]
Returns self
moved towards to
by the distance delta
, clamped by to
.
pub fn direction_to(
self,
other: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
[src]
self,
other: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
Returns the normalized vector pointing from this vector to other
.
pub fn distance_to(self, other: Vector2D<f32, UnknownUnit>) -> f32
[src]
Returns the distance to other
.
pub fn distance_squared_to(self, other: Vector2D<f32, UnknownUnit>) -> 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.
pub fn clamped(self, length: f32) -> Self
[src]
Returns the vector with a maximum length by limiting its length to length
.
Implementations on Foreign Types
impl Vector2Godot for Vector2D<f32, UnknownUnit>
[src]
pub fn aspect(self) -> f32
[src]
pub fn cubic_interpolate(
self,
b: Vector2D<f32, UnknownUnit>,
pre_a: Vector2D<f32, UnknownUnit>,
post_b: Vector2D<f32, UnknownUnit>,
t: f32
) -> Vector2D<f32, UnknownUnit>
[src]
self,
b: Vector2D<f32, UnknownUnit>,
pre_a: Vector2D<f32, UnknownUnit>,
post_b: Vector2D<f32, UnknownUnit>,
t: f32
) -> Vector2D<f32, UnknownUnit>
pub fn rotated(self, angle: Angle<f32>) -> Vector2D<f32, UnknownUnit>
[src]
pub fn slide(
self,
normal: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
[src]
self,
normal: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
pub fn snapped(
self,
by: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
[src]
self,
by: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
pub fn tangent(self) -> Vector2D<f32, UnknownUnit>
[src]
pub fn move_towards(
self,
to: Vector2D<f32, UnknownUnit>,
delta: f32
) -> Vector2D<f32, UnknownUnit>
[src]
self,
to: Vector2D<f32, UnknownUnit>,
delta: f32
) -> Vector2D<f32, UnknownUnit>
pub fn direction_to(
self,
other: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>
[src]
self,
other: Vector2D<f32, UnknownUnit>
) -> Vector2D<f32, UnknownUnit>