Open RJ opened 2 months ago
FixedJoints currently apply entity1's Rotation to entity2.
Rotation
This change allows you set a fixed rotation offset to entity2's Rotation, relative to entity1.
Here's the output difference in the fixed_joint_2d.rs example, if you make this change:
fixed_joint_2d.rs
- commands.spawn(FixedJoint::new(anchor, object).with_local_anchor_1(Vector::X * 100.0)); + commands.spawn( + FixedJoint::new(anchor, object) + .with_local_anchor_1(Vector::X * 100.0) + .with_rotation_offset(PI / 4.), // <--- NEW + );
https://github.com/user-attachments/assets/0e206743-37c5-4453-b4cc-d9cf3339d114
https://github.com/user-attachments/assets/5429ceb8-196b-486c-9adf-812c10f894eb
I've only visually confirmed this looks right in 2d. Hopefully the 3d version of my get_rotation_difference is correct.
get_rotation_difference
FixedJoint::with_rotation_offset
this change is so i can use a fixed joint to land on asteroids like this, maintaining the upright ship rotation:
https://github.com/user-attachments/assets/c7b834e0-124c-4805-9a38-72223b3a5660
Objective
FixedJoints currently apply entity1's
Rotation
to entity2.This change allows you set a fixed rotation offset to entity2's
Rotation
, relative to entity1.Here's the output difference in the
fixed_joint_2d.rs
example, if you make this change:Original output
https://github.com/user-attachments/assets/0e206743-37c5-4453-b4cc-d9cf3339d114
New output with rotation offset applied
https://github.com/user-attachments/assets/5429ceb8-196b-486c-9adf-812c10f894eb
Caveat
I've only visually confirmed this looks right in 2d. Hopefully the 3d version of my
get_rotation_difference
is correct.Changelog
FixedJoint::with_rotation_offset