Set default restitution
This commit is contained in:
parent
7c21eab970
commit
6f7d1a5f49
3 changed files with 6 additions and 3 deletions
|
|
@ -21,6 +21,9 @@ fn main() {
|
||||||
PhysicsPlugins::default(),
|
PhysicsPlugins::default(),
|
||||||
))
|
))
|
||||||
.insert_resource(Time::<Physics>::default().with_relative_speed(5.0))
|
.insert_resource(Time::<Physics>::default().with_relative_speed(5.0))
|
||||||
|
.insert_resource(DefaultRestitution(
|
||||||
|
Restitution::PERFECTLY_ELASTIC.with_combine_rule(CoefficientCombine::Max),
|
||||||
|
))
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(
|
.add_systems(
|
||||||
Update,
|
Update,
|
||||||
|
|
@ -75,7 +78,7 @@ fn spawn_ball(
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
RigidBody::Dynamic,
|
RigidBody::Dynamic,
|
||||||
Collider::circle(CIRCLE_RADIUS),
|
Collider::circle(CIRCLE_RADIUS),
|
||||||
Restitution::PERFECTLY_ELASTIC.with_combine_rule(CoefficientCombine::Max),
|
LinearVelocity(Vec2::new(time.elapsed_secs().sin(), time.elapsed_secs().cos()) * 100.0),
|
||||||
Mesh2d(meshes.add(Circle::new(CIRCLE_RADIUS))),
|
Mesh2d(meshes.add(Circle::new(CIRCLE_RADIUS))),
|
||||||
MeshMaterial2d(materials.add(Color::hsl(time.elapsed_secs().sin() * 360.0, 1.0, 0.5))),
|
MeshMaterial2d(materials.add(Color::hsl(time.elapsed_secs().sin() * 360.0, 1.0, 0.5))),
|
||||||
Transform::from_xyz(world_position.x, world_position.y, 0.0),
|
Transform::from_xyz(world_position.x, world_position.y, 0.0),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ PROFILE="${1:-release}"
|
||||||
|
|
||||||
if [ "$PROFILE" = "dev" ]; then
|
if [ "$PROFILE" = "dev" ]; then
|
||||||
PROFILE_DIR="debug"
|
PROFILE_DIR="debug"
|
||||||
CARGO_FLAGS=""
|
CARGO_FLAGS="--features=bevy/dynamic_linking"
|
||||||
else
|
else
|
||||||
PROFILE_DIR="release"
|
PROFILE_DIR="release"
|
||||||
CARGO_FLAGS="--release"
|
CARGO_FLAGS="--release"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.98.1"
|
channel = "1.98.1"
|
||||||
targets = ["wasm32-unknown-unknown", "x86_64-unknown-linux-gnu"]
|
targets = ["wasm32-unknown-unknown"]
|
||||||
components = ["clippy", "rust-analyzer", "rustfmt"]
|
components = ["clippy", "rust-analyzer", "rustfmt"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue