kitgit

tirbofish/dropbear · diff

d57f407 · Thribhu K

fix: implemented rotation for KCC Unverified

diff --git a/Cargo.toml b/Cargo.toml
index 41fa125..ff19719 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,7 +35,7 @@ glam = { version = "0.30", features = ["serde", "mint"] }
 hecs = { version = "0.11", features = ["serde"] }
 log = "0.4"
 log-once = "0.4"
-model_to_image = "0.1"
+#model_to_image = "0.1"
 once_cell = "1.21"
 parking_lot = {version = "0.12", features = ["deadlock_detection"] }
 rfd = "0.17"
diff --git a/crates/eucalyptus-core/src/physics/kcc.rs b/crates/eucalyptus-core/src/physics/kcc.rs
index a6bae53..6500a5a 100644
--- a/crates/eucalyptus-core/src/physics/kcc.rs
+++ b/crates/eucalyptus-core/src/physics/kcc.rs
@@ -40,6 +40,7 @@ pub mod jni {
     use jni::objects::{JClass, JObject};
     use jni::sys::{jboolean, jdouble, jlong};
     use rapier3d::dynamics::RigidBodyType;
+    use rapier3d::math::Rotation;
     use rapier3d::prelude::QueryFilter;
     use crate::{convert_jlong_to_entity, convert_ptr};
     use crate::physics::kcc::KCC;
@@ -155,6 +156,72 @@ pub mod jni {
     }
 
     #[unsafe(no_mangle)]
+    pub extern "system" fn Java_com_dropbear_physics_KinematicCharacterControllerNative_setRotation(
+        mut env: JNIEnv,
+        _: JClass,
+        world_handle: jlong,
+        physics_handle: jlong,
+        entity: jlong,
+        rotation: JObject,
+    ) {
+        let world = convert_ptr!(world_handle => World);
+        let physics_state = convert_ptr!(mut physics_handle => PhysicsState);
+        let entity = convert_jlong_to_entity!(entity);
+
+        let class = match env.find_class("com/dropbear/math/Quaterniond") {
+            Ok(cls) => cls,
+            Err(_) => {
+                let _ = env.throw_new("java/lang/RuntimeException", "Unable to find Quaterniond class");
+                return;
+            }
+        };
+
+        if let Ok(false) = env.is_instance_of(&rotation, &class) {

Large diffs are not rendered by default. Showing the first 50 of 207 lines. Show full diff