Struct TrajectoryPrediction
Allows the generation of a desired future trajecory.
Namespace: Unity.Kinematica
Syntax
public struct TrajectoryPrediction
Remarks
Allows the generation of a desired future trajecory by
predicting the future root movement over time subject
to a number of characteristics.
var prediction = TrajectoryPrediction.Create(
ref synthesizer, desiredVelocity, desiredRotation,
trajectory, velocityPercentage, forwardPercentage);
prediction.Generate();
Properties
Advance
Generates the next root transform of the trajectory.
Declaration
public AffineTransform Advance { get; }
Property Value
Type | Description |
---|---|
AffineTransform |
Remarks
The trajectory prediction generates samples along the trajectory which are subject to the time horizon and sample rate that are configured in the runtime asset.
The generated root transform can be modified before storing it in the trajectory buffer. A use case for this is for example collision detection and resolution.
See Also
Transform
Allows to get and set the current root transform during the trajectory generate.
Declaration
public AffineTransform Transform { get; set; }
Property Value
Type | Description |
---|---|
AffineTransform |
Methods
Create(ref MotionSynthesizer, float3, quaternion, MemoryArray<AffineTransform>, Single, Single)
Creates a trajectory prediction instance.
Declaration
public static TrajectoryPrediction Create(ref MotionSynthesizer synthesizer, float3 desiredLinearVelocity, quaternion desiredRotation, MemoryArray<AffineTransform> trajectory, float velocityFactor, float rotationFactor)
Parameters
Type | Name | Description |
---|---|---|
MotionSynthesizer | synthesizer | Reference to the motion synthesizer to generate the trajectory for. |
float3 | desiredLinearVelocity | Desired linear velocity in meters per second in character space. |
quaternion | desiredRotation | Desired orientation in character space. |
MemoryArray<AffineTransform> | trajectory | Memory array that the generated trajectory should be written to. |
Single | velocityFactor | Factor that determines when the desired velocity w.r.t. the time horizon should be reached. |
Single | rotationFactor | Factor that determines when the desired rotation w.r.t. the time horizon should be reached. |
Returns
Type | Description |
---|---|
TrajectoryPrediction | The newly created trajectory prediction instance. |
Generate()
Convenience method that generates the entire trajectory in a single call. It can be used instead of manually calling Advance() and Push() in case no root transform modification is required.
Declaration
public void Generate()
Push(AffineTransform)
Stores the root transform passed as argument as the next trajectory element in the internal buffer. This method can be used in conjunction with Advance().
Declaration
public bool Push(AffineTransform transform)
Parameters
Type | Name | Description |
---|---|---|
AffineTransform | transform | Root transform to be stored in the trajectory buffer. |
Returns
Type | Description |
---|---|
Boolean |