@Testitou
Ok, to summarize to make sure I got this right. You got:
If yes, I recommend using a StateMachine from LogicBricks as well as ParentHoldLink from my Essentials 8 package:
Ok, to summarize to make sure I got this right. You got:
- Two hair presets: One for with helmet, one without
- And separately you got a Helmet asset as CustomUnityAtom
If yes, I recommend using a StateMachine from LogicBricks as well as ParentHoldLink from my Essentials 8 package:
- Add a CustomUnityAsset with your helmet to the scene, name it "Helmet"
- Load the helmet on hair preset onto your character.
- Place the helmet on the head and align it properly
- Add the ParentHoldLink plugin to the Helmet atom. Follow the instructions in the plugin UI to link it to head of your character. Use "head", not "headControl". Then disable the "Reset" checkbox of the plugin. (Important: Make sure to use the newest version Essentials 8, otherwise you won't have that checkbox)
- Add a StateMachine plugin somewhere to your scene. E.g. add an Empty atom and name it "StateMachine".
- Setup two states for the StateMachine: HelmetON and HelmetOFF
- Both states should be set to InfiniteDuration, assuming you want to switch with some external logic, like a button? (Otherwise you would need to setup some more states for other things to do as well transitions between the states)
- For the HelmetON state setup the following in "Actions OnEnterHelmetON":
- Trigger: Person -> HairPresets -> LoadPresetWithPath (and select whatever hair preset you got for helmet on)
- Trigger: Helmet -> AtomControl -> on (set to checked)
- Still for HelmetON state, setup the following in "Actions OnExitHelmetON". (Alternatively you could do it OnEnter of the other state, whatever you like more)
- Trigger: Person -> HairPresets -> LoadPresetWithPath (and select whatever hair preset you got for helmet off)
- Trigger: Helmet -> AtomControl -> on (set to unchecked)
- From anywhere in the scene you can trigger StateMachine -> plugin#0_MacGruber.StateMachine -> SwitchState (set to the name of the state you want to go to: "HelmetON" or "HelmetOFF")
- If you wanna go more advanced, you could also create an animation for taking the helmet on and off, like grabing the helmet and with one of both hands and actually putting it on the head. You would need two ParentHoldLink plugins on the Helmet, one for the head link one for the hand link. You would turn on/off the plugins instead the entire helmet atom. Otherwise its just a thing of doing the switch with the right timing with the animation. Naturally I would recommend IdlePoser for the animation, but it could also be an AnimPattern or Timeline. The StateMachine would need additional states for the animation of course, e.g. with "Wait for TriggerSync" set, so the state waits for the animation to trigger "TriggerSync" on the StateMachine.