mirror of
https://github.com/lune-org/lune.git
synced 2025-04-13 23:10:52 +01:00
Add Vector2:Angle(rhs)
This commit is contained in:
parent
8aefe88104
commit
fb888ce8c2
1 changed files with 3 additions and 0 deletions
|
@ -52,6 +52,9 @@ impl LuaUserData for Vector2 {
|
||||||
|
|
||||||
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
|
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
|
||||||
// Methods
|
// Methods
|
||||||
|
methods.add_method("Angle", |_, this, rhs: LuaUserDataRef<Vector2>| {
|
||||||
|
Ok(this.0.angle_between(rhs.0))
|
||||||
|
});
|
||||||
methods.add_method("Cross", |_, this, rhs: LuaUserDataRef<Vector2>| {
|
methods.add_method("Cross", |_, this, rhs: LuaUserDataRef<Vector2>| {
|
||||||
let this_v3 = Vec3::new(this.0.x, this.0.y, 0f32);
|
let this_v3 = Vec3::new(this.0.x, this.0.y, 0f32);
|
||||||
let rhs_v3 = Vec3::new(rhs.0.x, rhs.0.y, 0f32);
|
let rhs_v3 = Vec3::new(rhs.0.x, rhs.0.y, 0f32);
|
||||||
|
|
Loading…
Add table
Reference in a new issue