NPC Looking At Camera After Trigger Event

Hi,

Doesn’t Transform from Bone Space in
Event Graph and “Transform (Modify)
Bone” in AnimGraph will do double
rotation?

No,
That node is converting a bone transform (+ input pins params if given) to world space coordinates.

We do that because we retrieve the camera location in world space so we need to keep consistent data for rotation computations.
That said I forgot to mention that you need to unlock Bone transform updates in Modify Bone Node within the AnimGraph in order to updates the bones transforms…

Rotation Mode to Replace and Rotation Space to world space to match the computations in the event graph…

In Event Graph there are “Get Player
Character” and “Get Player Camera
Manager” nodes with both Player Index
value of 0. Isn’t it supposed to be
the player? Aren’t we supposed to make
one of them the mesh we want to rotate
it as target to “Transform from Bone
Space”?

Well, at this point I want to say that it’s better that you create a Class Blueprint for the main character logic you want to implement and an AnimationBlueprint for…Animation/Bone management.

From your screenshots I can see that basically, you drag the animblueprint in the level while it’s better to drag a Class blueprint for which it’s skeletal mesh component is defined to be controlled by another AnimationBlueprint.

This is by far better because:

  1. You may want to reuse the logic you write for a component. This is more complicated to manage if you put all the component logic in a LevelBlueprint. Now I understand better why you’ve put the logic in the Level blueprint, basically to have access to the mesh instance you dragged in the level because it seems tricky to get it’s referenced skeletal mesh in the AnimBlueprint when you only have the latter used in the scene…
  2. Using a Class Blueprint let you add a lot of different components attached to your main one. The main mesh of course but also, for example, you can attach sounds, sensing component, trigger boxes and so on…and you have access to them automatically in all graphs of the blueprint. Then in the AnimBlueprint linked, to get the class bp ref, you only need a simple cast while you initialize it and you’ll see your class blueprint showing in the list of cast automatically…

I’ve tried in my project by dragging the turret anim bp into the scene and while I can get a few references like the controller and things like that, I cannot get a reference of the (skinned/skeletal) mesh in the event graph…
Maybe it’s possible but at this point and for the reasons I’ve wrote above, it’s definitely better to have

  1. One Class blueprint for the main logic of your component
  2. When apply, an animation Blueprint (that you specify being used in the animation section of your mesh class blueprint) to control all animation aspects of your skeletal mesh.

In the class blueprint I control all aspects related to sensing ennemies, triggering sounds, spawning bullets and particles…etc in an Event driven (custom event is nice :slight_smile:
In the animation blueprint, I manage the state machine and events related to turret animation…Perhaps, depending animation states, triggering in AnimBP the custom events defined in the Class BP…

Courage! :wink: