Class AIAimProfile
- Namespace
- FishMMO.Server.Implementation.World.SceneServer.AI
- Assembly
- FishMMO.Server.dll
How well an NPC aims: which point on a target it shoots at, how long it needs to settle, and how far it misses by while it has not.
[CreateAssetMenu(fileName = "New AI Aim Profile", menuName = "FishMMO/Character/NPC/AI/Aim Profile", order = 20)]
public class AIAimProfile : ScriptableObject
- Inheritance
-
ObjectScriptableObjectAIAimProfile
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.MemberwiseClone()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Assign on the archetype, never on the prefab. The archetype is the single source of an NPC's brain, and aim quality is part of that brain — a prefab-level aim slot would let an NPC quietly disagree with the archetype it names, which is the failure the archetype design exists to prevent.
A null profile means perfect aim. Every archetype that does not name one keeps exactly the behaviour it has today — an exact ray from the aim origin to the target's centre — so adding this system changes nothing until a profile is authored. That is deliberate: the profile is a tuning instrument, and the untuned default should be the behaviour everyone already has rather than a guess at what a stranger's aim ought to feel like.
The three dials are independent. BaseAccuracy and SpreadDegrees say how far off a settled shot is; LockSeconds says how long settling takes; LeadAccuracy says whether it compensates for a target that is running. An NPC that is deadly against a stationary target and hopeless against a moving one, or the reverse, is a combination of these and not a new mechanism.
Fields
AimPoint
[Header("Where to Aim")]
[Tooltip("Which point on the target's body an ability is aimed at.")]
public AIAimPoint AimPoint
Field Value
BaseAccuracy
[Header("Accuracy")]
[Range(0, 1)]
[Tooltip("Accuracy reached once the target has been tracked for LockSeconds. 1 is a perfect shot; 0 is the full spread on every cast.")]
public float BaseAccuracy
Field Value
LeadAccuracy
[Header("Target Movement")]
[Range(0, 1)]
[Tooltip("How much of the shot's flight time is compensated for. 0 ignores a moving target, 1 leads it perfectly.")]
public float LeadAccuracy
Field Value
LockSeconds
[Tooltip("Seconds of continuously tracking a target before accuracy reaches BaseAccuracy. 0 disables the ramp.")]
public float LockSeconds
Field Value
MinimumLockToFire
[Tooltip("Seconds of tracking required before the NPC will cast at all. 0 casts immediately. Requires LockSeconds to be greater than 0 to ever be satisfied.")]
public float MinimumLockToFire
Field Value
SpreadDegrees
[Tooltip("Worst-case angular error in degrees, reached at zero accuracy. 0 is a perfect shot.")]
public float SpreadDegrees
Field Value
Methods
Validate(List<string>)
Checks this profile for combinations that cannot behave as configured.
public bool Validate(List<string> problems)
Parameters
Returns
- bool
True when the profile is internally consistent.
Remarks
Same contract as Validate(List<string>): every problem returned is one that would compile, run, and then quietly do nothing, so the shipped profiles can be asserted in an EditMode test rather than discovered in play.