Contextual Animations and First Person

I have a few questions about the Contextual animation plugin

  • How would one handle different first and third animations for a contextual animation that you need to play something in 3rd person, but also in first person. Such that if third person is toggled during the sync, things will appear in sync.
  • Currently, the sync system I built years ago prior to this plugin existing is sequencer based, and I handled first and third person by playing animations on different montage channels of the same bound actor. Looks like I can do the same here, sortof, but there doesn’t appear to be any mechanism to change the montage section in the preview.
  • I thought maybe I could provide a PreviewAnimInstanceClass(one for 1P and 3P) as a workaround, but that doesn’t work either. It looks like the code calls SetAnimInstanceClass, but then never passes the track animation to it in any way. I figured it might call
  • How do you add animations to an existing section? For instance, if you add roles but already have some sections set up. Do I have to recreate via New AnimSet?
  • What is the difference in “Section” and “AnimSet”
    • Sections I gather are similar to montage sections, going by the example usage in FStateTreeTask_PlayContextualAnim.
    • Looks like sections can loop, and you can use transition functions on UContextualAnimSceneActorComponent to set up a flow through them.
    • When you use “New AnimSet” in the editor, it just creates a new section. But I see in code, they are independent concepts tied to conditions. Kinda looks like your meant to be able to use a fixed set of named sections, but have the anim set vary by conditions. But how the tooling currently works doesn’t seem to make sense for that, so I’m not sure.
  • What do attachment params do?
    • Currently it only seems to be used in FContextualAnimViewModel::GetSelectionDebugText
  • Does the Contextual Anim system work in MP?

Feature Request

  • Need a way to preview specific montage slots

Thanks

[Attachment Removed]

Hey there,

Before I answer your questions, the Contextual Animation System (CAS) is experimental and has no dedicated development happening.

How would one handle different first and third animations for a contextual animation that you need to play something in 3rd person, but also in first person. Such that if third person is toggled during the sync, things will appear in sync.

CAS handles syncing montages onto meshes and actors, if you need to move between 1st and 3rd person you will need to handle that yourself.

Looks like I can do the same here, sortof, but there doesn’t appear to be any mechanism to change the montage section in the preview.

Correct, you would need to make an animset for this, and use the conditions to drive that.

It looks like the code calls SetAnimInstanceClass, but then never passes the track animation to it in any way.

This sounds like a bug; again, being experimental, I would expect bugs like this.

What is the difference in “Section” and “AnimSet”

Think of the CAS asset as a library of animations, and so imagine a CAS asset of car entrances. You would define multiple sections for different car types, and animsets would use conditionals to evaluate which montages play for each door entrance.

Sections I gather are similar to montage sections, going by the example usage in FStateTreeTask_PlayContextualAnim.

No, this is to indicate which of the overall sections, as I mentioned above, to play. Then the internal evaluation happens, and the animation gets chosen.

Looks like sections can loop, and you can use transition functions on UContextualAnimSceneActorComponent to set up a flow through them.

Yes, though in practice this is rare. Often it is play animation and then be done.

When you use “New AnimSet” in the editor, it just creates a new section. But I see in code, they are independent concepts tied to conditions. Kinda looks like your meant to be able to use a fixed set of named sections, but have the anim set vary by conditions. But how the tooling currently works doesn’t seem to make sense for that, so I’m not sure.

I hope the differentiation is clear above, but there is a user that has created a “how-to” of sorts on how to use CAS.

https://vorixo.github.io/devtricks/contextual-anim/

What do attachment params do

These are your alignment sync points and allow you to warp a character to that alignment point.

Does the Contextual Anim system work in MP?

Yes, though it is very rudimentary and has no syncing or prediction, it’s a play and pray approach. You will find issues.

Regarding feature requests, I can pass them along, but you are better off adding this functionality for yourself for now.

Dustin

[Attachment Removed]

That’s great info! I’ll pass the asks along to the team.

Dustin

[Attachment Removed]

Thanks for your response.

I hope it does get some more resourcing to see it further. I think it’s already a great foundation not really covered elsewhere in the engine.

Over the weekend as I was playing with it trying to implement our most complex sync usage (ai grab player, struggle loop x3 -> bite loop until dead, if appropriate input is received during struggle or bite, it can push the guy off of you). The flow of these ‘states’ seems to be logically tied to the the section names, since there is a mechanism to change state with TransitionContextualAnimScene ( FName SectionName ) and such. The logic for input consideration, and branching would probably be driven by a state tree associated with the sequence, so that’s also why I was playing with that as well. I’d have to write custom state tree tasks/conditions to cover these bases, but even in its experimental state CAS significantly simpler than the sequencer driven approach I built years ago. UDN has a number of posts going back to 2023 when I was working on it and bringing issues to UDN([such [Content removed] I’m happy to see this plugin exist, even if it’s experimental, and might be for some time. It’s a difficult set of problems. I’ve outlined my approach a long time ago, to share with others.

Thanks

Jeremy

Also, I ‘solved’ the 1P/3P aspect by just keeping 2 roles (Attacker, Target), and the montage played on the player will just have 2 animations in it, one on first person and one on third person slot. To control which one you see in the editor, I made a minor tweak to the CAS editor code so I can provide a slot index to preview.

[Attachment Removed]