I’ve created a model of a wind vane with a bone structure that allows me to rotate the wind arrow. To animate the SkeletalMesh I’ve created a Anim Blueprint that uses a transform bone node to rotate the wind arrow to point in a given direction. Right now, that direction is initialized and randomly offset each frame within the blueprint. What I would like to do is have the wind direction be a property of the world and pull that value into the Anim Blueprint.
What is the best way to store the wind direction with the world? How do I access that wind direction with the Anim Blueprint?
I have fooled around with a WindDirectionalSource actor, but have found no way to utilize it. Ideally, the single world-defined wind would impact particles (what I can gather WindDirectionalSource does), animations such as my wind vane, and gameplay mechanics (my game involves flight).
I’ve realized I probably shouldn’t be using an anim blueprint for dynamically transforming the bones, as the skeletal mesh has no need for animation sequences. The only animation is dynamic in response to the wind direction, which is better achieved using a PosableMeshComponent.
I’m still fooling around with the best way to implement a wind that implements all aspects of the game consistently and without having to reproduce state. My current set up consists of a WindApplyingComponent and WindImpactedInterface defined in C++. The WindApplyingComponent has a tick function that checks to see if the owning actor implements WindImpactInterface, and if so calls a function in the interface that passes along the vector returned from World->Scene->GetWindParameters(…). This allows me to define the wind by placing a WindDirectionalSource actor in the map that adds it’s influence to the scene’s wind parameters.
I have a wind vane actor (in Blueprint) that includes aPosableMeshComponent and WindApplyingComponent and implements WindImpactedInterface. The BlueprintImplementableEvent function declared by the interface is implemented in the actor’s EventGraph to calculate the rotation needed to point the arrow into the wind and apply it to the appropriate bone in the mesh.
The above is working reasonably well for now, but I’m still hoping someone has a better idea, as this seems a bit hacky with the interface and all. This is likely a better suited for the forums now…