External Motions
Creating new external motion modules
Create a new script that will inherit from the ExternalMotionData class and define the name of the motion.
using System;
namespace UHFPS.Runtime
{
[Serializable]
public class TestExternalMotion : ExternalMotionData
{
public override string Name => "Test Motion";
public override ExternalMotionModule GetPosition => null;
public override ExternalMotionModule GetRotation => null;
}
}Create a new structure that will contain variables for position and rotation settings.
using System;
using UnityEngine;
namespace UHFPS.Runtime
{
[Serializable]
public class TestExternalMotion : ExternalMotionData
{
[Serializable]
public struct TestSettings
{
public Vector3 Force;
public float Duration;
}
public TestSettings PositionSettings;
public TestSettings RotationSettings;
public override string Name => "Test Motion";
public override ExternalMotionModule GetPosition => null;
public override ExternalMotionModule GetRotation => null;
}
}Create a new subclass inside the base external motion class that will inherit from the ExternalMotionModule class.
Assign a class that inherits from ExternalMotionModule to the GetPosition and GetRotation properties.
Here is the full code of the test force module:
After creating a new external motion module, you will be able to add this module to the External Motion State Data of the Player Item.

Last updated