stride/samples/Input/GravitySensor/GravitySensor.Game/BounceScript.cs

21 lines
736 B
C#
Raw Permalink Normal View History

2021-04-19 03:49:55 +00:00
// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
2018-06-19 09:06:54 +00:00
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
2020-04-14 14:37:41 +00:00
using Stride.Engine;
2018-06-19 09:06:54 +00:00
namespace GravitySensor
{
/// <summary>
/// This script will set the restitution of each rigidbody element to 1.0f to allow the entity to bounce
/// </summary>
public class BounceScript : StartupScript
{
public override void Start()
{
foreach (var physicsElement in Entity.GetAll<PhysicsComponent>())
{
physicsElement.Restitution = 0.9f;
}
}
}
}