Skip to content

ssarg fix the ae2 conflict and the raper3d getpose non-unwinding panic - #1396

Open
mynameisgrass wants to merge 1 commit into
ryanhcode:mainfrom
mynameisgrass:main
Open

ssarg fix the ae2 conflict and the raper3d getpose non-unwinding panic#1396
mynameisgrass wants to merge 1 commit into
ryanhcode:mainfrom
mynameisgrass:main

Conversation

@mynameisgrass

Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings July 26, 2026 03:11
@CLAassistant

CLAassistant commented Jul 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the Rapier JNI bridge and related pipeline code to avoid crashes/panics when physics objects are missing or native calls fail, and adds additional diagnostics while adjusting build metadata.

Changes:

  • Rust: make rigid-body lookups fallible (Option) and guard multiple JNI entrypoints against missing IDs.
  • Rust: make joint and box removal paths tolerate missing rigid body mappings.
  • Java: add [SableDebug] logging and exception logging around key native calls; update project version/credits.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sable_rapier/src/main/rust/rapier/src/lib.rs Switch rigid body accessors to Option and guard several JNI functions from panicking on missing IDs.
sable_rapier/src/main/rust/rapier/src/joints.rs Add helper to resolve rigid bodies (including ground) and return sentinel on missing mapping instead of panicking.
sable_rapier/src/main/rust/rapier/src/boxes.rs Make removeBox tolerant of missing rigid-body mapping.
sable_rapier/src/main/java/dev/ryanhcode/sable/physics/impl/rapier/RapierPhysicsPipeline.java Add debug/error logging and try/catch around native calls; adjust wake-up path to use Rapier3D.getID.
gradle.properties Update version suffix and credits list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to +536
if let Some(rb) = get_rigid_body(&sim_data, &sable_data, id as LevelColliderID) {
let arr: [jdouble; 7] = [
rb.translation().x as jdouble,
rb.translation().y as jdouble,
rb.translation().z as jdouble,
rb.rotation().x as jdouble,
rb.rotation().y as jdouble,
rb.rotation().z as jdouble,
rb.rotation().w as jdouble,
];

let _ = env.set_double_array_region(&store, 0, &arr);
}
Comment on lines +1359 to +1363
if let Some(rb) = get_rigid_body(&sim_data, &sable_data, id as LevelColliderID) {
let vel = rb.linvel();

let vel = rb.linvel();

_env.set_double_array_region(
&store,
0,
&[vel.x as jdouble, vel.y as jdouble, vel.z as jdouble],
)
.unwrap();
_env.set_double_array_region(
&store,
Comment on lines +1387 to +1391
if let Some(rb) = get_rigid_body(&sim_data, &sable_data, id as LevelColliderID) {
let vel = rb.angvel();

_env.set_double_array_region(
&store,
0,
&[vel.x as jdouble, vel.y as jdouble, vel.z as jdouble],
)
.unwrap();
_env.set_double_array_region(
&store,
Comment on lines 118 to 122
@Override
public void init(@Nullable final Vector3dc gravity, final double universalDrag) {
try {
Sable.LOGGER.info("[SableDebug] Initializing Rapier physics pipeline with gravity=({}, {}, {}), drag={}", gravity.x(), gravity.y(), gravity.z(), universalDrag);
this.scene = new RapierPhysicsScene(Rapier3D.initialize(gravity.x(), gravity.y(), gravity.z(), universalDrag));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants