1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#if MODULE_ENTITIES
using Unity.Entities;
using UnityEngine;
using Unity.Mathematics;
namespace Pathfinding.ECS {
using Pathfinding.PID;
/// <summary>How to calculate which direction is "up" for the agent</summary>
public enum MovementPlaneSource : byte {
/// <summary>
/// The graph's natural up direction will be used to align the agent.
/// This is the most common option.
/// </summary>
Graph,
/// <summary>
/// The agent will be aligned with the normal of the navmesh.
///
/// This is useful when you have a spherical world, or some other strange shape.
///
/// The agent will look at the normal of the navmesh around the point it is currently standing on to determine which way is up.
/// The radius of the agent will be used to determine the size of the area to sample the normal from.
/// A bit of smoothing is done to make sure sharp changes in the normal do not cause the agent to rotate too fast.
///
/// Note: If you have a somewhat flat world, and you want to align the agent to the ground, this is not the option you want.
/// Instead, you might want to disable <see cref="FollowerEntity.updateRotation"/> and then align the transform using a custom script.
///
/// Warning: Using this option has a performance penalty.
///
/// [Open online documentation to see videos]
///
/// See: spherical (view in online documentation for working links)
/// </summary>
NavmeshNormal,
/// <summary>
/// The agent will be aligned with the ground normal.
///
/// This is useful when you have a spherical world, or some other strange shape.
///
/// You may want to use this instead of the NavmeshNormal option if your collider is smoother than your navmesh.
/// For example, if you have a spherical world with a sphere collider, you may want to use this option instead of the NavmeshNormal option.
///
/// Note: If you have a somewhat flat world, and you want to align the agent to the ground, this is not the option you want.
/// Instead, you might want to disable <see cref="FollowerEntity.updateRotation"/> and then align the transform using a custom script.
///
/// Warning: Using this option has a performance penalty.
/// </summary>
Raycast,
}
[System.Serializable]
public struct MovementSettings : IComponentData {
/// <summary>Additional movement settings</summary>
public PIDMovement follower;
/// <summary>Flags for enabling debug rendering in the scene view</summary>
public PIDMovement.DebugFlags debugFlags;
/// <summary>
/// How far away from the destination should the agent aim to stop, in world units.
///
/// If the agent is within this distance from the destination point it will be considered to have reached the destination.
///
/// Even if you want the agent to stop precisely at a given point, it is recommended to keep this slightly above zero.
/// If it is exactly zero, the agent may have a hard time deciding that it
/// has actually reached the end of the path, due to floating point errors and such.
///
/// Note: This will not be multiplied the agent's scale.
/// </summary>
public float stopDistance;
/// <summary>
/// How much to smooth the visual rotation of the agent.
///
/// This does not affect movement, but smoothes out how the agent rotates visually.
///
/// Recommended values are between 0.0 and 0.5.
/// A value of zero will disable smoothing completely.
///
/// The smoothing is done primarily using an exponential moving average, but with
/// a small linear term to make the rotation converge faster when the agent is almost facing the desired direction.
///
/// Adding smoothing will make the visual rotation of the agent lag a bit behind the actual rotation.
/// Too much smoothing may make the agent seem sluggish, and appear to move sideways.
///
/// The unit for this field is seconds.
/// </summary>
public float rotationSmoothing;
public float positionSmoothing;
/// <summary>
/// Layer mask to use for ground placement.
/// Make sure this does not include the layer of any colliders attached to this gameobject.
///
/// See: <see cref="GravityState"/>
/// See: https://docs.unity3d.com/Manual/Layers.html
/// </summary>
public LayerMask groundMask;
/// <summary>
/// How to calculate which direction is "up" for the agent.
/// See: <see cref="MovementPlaneSource"/>
///
/// Deprecated: Use the AgentMovementPlaneSource component instead, or the movementPlaneSource property on the FollowerEntity component
/// </summary>
[System.Obsolete("Use the AgentMovementPlaneSource component instead, or the movementPlaneSource property on the FollowerEntity component")]
public MovementPlaneSource movementPlaneSource;
/// <summary>\copydocref{IAstarAI.isStopped}</summary>
public bool isStopped;
}
}
#endif
|