optional head drop impulse
This commit is contained in:
@@ -32,7 +32,9 @@ fn on_head_drop(
|
||||
let angle = rand::random::<f32>() * PI * 2.;
|
||||
let spawn_impulse = Quat::from_rotation_y(angle) * Vec3::new(0.5, 0.6, 0.).normalize() * 180.;
|
||||
|
||||
if drop.impulse {
|
||||
let impulse = drop.impulse;
|
||||
|
||||
if impulse {
|
||||
commands.server_trigger(ToClients {
|
||||
mode: SendMode::Broadcast,
|
||||
message: PlaySound::HeadDrop,
|
||||
@@ -49,7 +51,6 @@ fn on_head_drop(
|
||||
Collider::sphere(1.5),
|
||||
LockedAxes::ROTATION_LOCKED,
|
||||
RigidBody::Dynamic,
|
||||
OneShotImpulse(spawn_impulse),
|
||||
CollisionLayers::new(GameLayer::CollectiblePhysics, GameLayer::Level),
|
||||
Restitution::new(0.6),
|
||||
Children::spawn(SpawnWith({
|
||||
@@ -71,6 +72,7 @@ fn on_head_drop(
|
||||
})),
|
||||
Replicated,
|
||||
))
|
||||
.insert_if(OneShotImpulse(spawn_impulse), move || impulse)
|
||||
.with_child((
|
||||
Billboard::All,
|
||||
SquishAnimation(2.6),
|
||||
|
||||
Reference in New Issue
Block a user