Skip to content

Commit 8aece86

Browse files
committed
Directly unwrap center of mass
1 parent 70ab60e commit 8aece86

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

common/src/main/rust/rapier/src/joints.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ pub fn tick(scene_id: jint) {
7272
let local_anchor_1 = joint.pos_a
7373
- joint
7474
.id_a
75-
.and_then(|id| scene.level_colliders.get(&id))
76-
.and_then(|rb| rb.center_of_mass)
75+
.and_then(|v| scene.level_colliders.get(&v))
76+
.map(|v| v.center_of_mass.unwrap())
7777
.unwrap_or_default();
7878
impulse_joint.data.set_local_anchor1(Vector::new(
7979
local_anchor_1.x as Real,
@@ -90,8 +90,8 @@ pub fn tick(scene_id: jint) {
9090
let local_anchor_2 = joint.pos_b
9191
- joint
9292
.id_b
93-
.and_then(|id| scene.level_colliders.get(&id))
94-
.and_then(|rb| rb.center_of_mass)
93+
.and_then(|v| scene.level_colliders.get(&v))
94+
.map(|v| v.center_of_mass.unwrap())
9595
.unwrap_or_default();
9696
impulse_joint.data.set_local_anchor2(Vector::new(
9797
local_anchor_2.x as Real,

0 commit comments

Comments
 (0)