From 728bca3d27452d1a67cd30c8605490499f914def Mon Sep 17 00:00:00 2001 From: dusk Date: Thu, 29 Aug 2024 23:51:27 +0300 Subject: [PATCH] fix: stuff --- addons/boids/boids.gdextension | 8 ++++---- rust/src/boid/boid_2d.rs | 8 ++++++++ rust/src/boid/boid_3d.rs | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/addons/boids/boids.gdextension b/addons/boids/boids.gdextension index 3a77d3a..f87e151 100644 --- a/addons/boids/boids.gdextension +++ b/addons/boids/boids.gdextension @@ -5,11 +5,11 @@ reloadable = true [libraries] linux.debug.x86_64 = "res://rust/target/debug/libboids.so" -linux.release.x86_64 = "res://lib/libboids.x86.so" windows.debug.x86_64 = "res://rust/target/debug/boids.dll" -windows.release.x86_64 = "res://lib/boids.x86.dll" -macos.release = "res://lib/libboids.x86.dylib" -macos.release.arm64 = "res://lib/libboids.arm64.dylib" +linux.release.x86_64 = "res://addons/boids/lib/libboids.x86.so" +windows.release.x86_64 = "res://addons/boids/lib/boids.x86.dll" +macos.release = "res://addons/boids/lib/libboids.x86.dylib" +macos.release.arm64 = "res://addons/boids/lib/libboids.arm64.dylib" [icons] BoidProperties = "res://addons/boids/resources/boid_properties.svg" diff --git a/rust/src/boid/boid_2d.rs b/rust/src/boid/boid_2d.rs index 1c20831..7e03276 100644 --- a/rust/src/boid/boid_2d.rs +++ b/rust/src/boid/boid_2d.rs @@ -27,6 +27,14 @@ impl Boid2D { Vector2::new(self.vel.x, self.vel.y) } + #[func] + #[inline(always)] + /// Set the current velocity of this boid. + fn set_velocity(&mut self, new_velocity: Vector2) { + self.vel.x = new_velocity.x; + self.vel.y = new_velocity.y; + } + #[func] #[inline(always)] /// Get the ID of this boid. diff --git a/rust/src/boid/boid_3d.rs b/rust/src/boid/boid_3d.rs index b99c5c7..9daf0d9 100644 --- a/rust/src/boid/boid_3d.rs +++ b/rust/src/boid/boid_3d.rs @@ -27,6 +27,13 @@ impl Boid3D { Vector3::new(self.vel.x, self.vel.y, self.vel.z) } + #[func] + #[inline(always)] + /// Set the current velocity of this boid. + fn set_velocity(&mut self, new_velocity: Vector3) { + self.vel = to_glam_vec(new_velocity); + } + #[func] #[inline(always)] /// Get the ID of this boid.