tirbofish/dropbear · diff
fix: implemented rotation for KCC Unverified
@@ -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" @@ -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