加了个球

This commit is contained in:
shenjack 2023-04-20 20:51:02 +08:00
parent df4b0497de
commit 9a2385155e

View File

@ -17,7 +17,9 @@ pub fn simluation() -> PyResult<()> {
/* Create the ground. */ /* Create the ground. */
let collider = ColliderBuilder::cuboid(100.0, 0.1).build(); let collider = ColliderBuilder::cuboid(100.0, 0.1).build();
let ball = ColliderBuilder::ball(10).build();
collider_set.insert(collider); collider_set.insert(collider);
collider_set.insert(ball);
/* Create the bouncing ball. */ /* Create the bouncing ball. */
let rigid_body = RigidBodyBuilder::dynamic().translation(vector![0.0, 10.0]).build(); let rigid_body = RigidBodyBuilder::dynamic().translation(vector![0.0, 10.0]).build();
@ -57,7 +59,7 @@ pub fn simluation() -> PyResult<()> {
); );
let ball_body = &rigid_body_set[ball_body_handle]; let ball_body = &rigid_body_set[ball_body_handle];
println!("Ball altitude: {}", ball_body.translation().y); println!("Ball altitude: {}", ball_body.translation());
} }
Ok(()) Ok(())
} }