Skip to content

Commit a35ff39

Browse files
committed
Add velocity to RBD data
1 parent 5f8a8f1 commit a35ff39

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

blobs/src/rigid_body.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ impl Deref for RigidBodyHandle {
1818
#[derive(Copy, Clone, Debug)]
1919
pub struct RigidBodyData {
2020
pub position: Vec2,
21+
pub velocity: Vec2,
2122
pub center_of_mass: Vec2,
2223
pub mass: f32,
2324
pub rotation: f32,
@@ -27,6 +28,7 @@ impl Default for RigidBodyData {
2728
fn default() -> Self {
2829
Self {
2930
position: Vec2::ZERO,
31+
velocity: Vec2::ZERO,
3032
center_of_mass: Vec2::ZERO,
3133
mass: 1.0,
3234
rotation: 0.0,
@@ -73,9 +75,10 @@ impl RigidBody {
7375
pub fn data(&self) -> RigidBodyData {
7476
RigidBodyData {
7577
position: self.position,
78+
velocity: self.calculated_velocity,
79+
rotation: self.rotation,
7680
center_of_mass: self.center_of_mass,
7781
mass: self.calculated_mass,
78-
rotation: self.rotation,
7982
}
8083
}
8184

0 commit comments

Comments
 (0)