Table of Contents

Class FXBoneAttachment

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Seats an effect's emitter on bones of the humanoid model it was instantiated under: one copy per bone, so a pair of feet gets an emitter at each ankle.

[DisallowMultipleComponent]
public sealed class FXBoneAttachment : MonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
FXBoneAttachment
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
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.name
Object.hideFlags

Remarks

Where it runs. A buff's effect is instantiated under the character's ICharacter.MeshRoot (OnApplyFX(Buff, ICharacter)), on the owner and every observer alike, and destroyed when the buff leaves. This component looks for the model's UnityEngine.Animator under that parent and moves the emitter onto the bones the avatar maps (HumanoidBones, the lookup CharacterBody sets the feet on the ground with), so nothing has to be added to the models for it: every humanoid rig already says where its ankles are.

Ownership. The emitters live under the bones, not under this object, so they are destroyed with it (FishMMO.Shared.FXBoneAttachment.OnDestroy()): the buff ending, the controller tearing the effect down, and a model reload that clears the root all end them. A model reload re-creates the effect through the buff controller, which seats it afresh.

Size. Effect prefabs are authored to fit a one-metre cube (ParticleAdjuster), so an emitter is scaled to WorldSize metres whatever scale the bone it rides carries (an imported rig's bones are often scaled by its units).

No humanoid rig (an animal, a prop, a model still loading past ResolveTimeoutSeconds): the emitter stays where the prefab put it, at the root's feet, which is still the right place for an effect about the feet. Nothing is logged for it; it is not a fault.

Fields

Bones

The bones to seat an emitter on. The first takes Emitter itself; the rest take copies.

[Tooltip("The bones to seat an emitter on. The first takes the emitter itself; the rest take copies.")]
public HumanBodyBones[] Bones

Field Value

HumanBodyBones[]

Emitter

The child that is moved onto the bones.

[Tooltip("The child that is moved onto the bones.")]
public Transform Emitter

Field Value

Transform

KeepUpright

Hold each seated emitter level in the world (no tilt or spin from the bone), for a shape that must lie flat, such as a ring around the ankle. Its position still follows the bone.

[Tooltip("Hold each seated emitter level in the world (position still follows the bone). For shapes that must lie flat, like a ring around the ankle.")]
public bool KeepUpright

Field Value

bool

ResolveTimeoutSeconds

How long to keep looking for a rig that has not loaded yet before settling at the root.

[Tooltip("How long to keep looking for a rig that has not loaded yet before settling at the root.")]
public float ResolveTimeoutSeconds

Field Value

float

WorldOffset

Offset from the bone, in world metres (up is world up).

[Tooltip("Offset from the bone, in world metres.")]
public Vector3 WorldOffset

Field Value

Vector3

WorldSize

The emitter's size in metres; the effect is authored to a one-metre cube.

[Tooltip("The emitter's size in metres. The effect is authored to a one-metre cube (ParticleAdjuster).")]
public float WorldSize

Field Value

float