/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Samples
{
using UnityEngine;
///
/// Uses Rigidbody.MovePosition to move the Rigidbody.
///
public class RigidbodyController : MonoBehaviour
{
[Tooltip("The amount that the rigidbody should move each FixedUpdate.")]
[SerializeField] protected Vector3 m_MoveAmount;
private Rigidbody m_Rigidbody;
///
/// Initialize the default values.
///
private void Awake()
{
m_Rigidbody = GetComponent();
}
///
/// Moves the Rigidbody.
///
private void FixedUpdate()
{
m_Rigidbody.MovePosition(m_Rigidbody.position + m_MoveAmount * Time.fixedDeltaTime);
}
}
}