This is a design decision question. As a “getting to know Unreal” project I am implementing a simple airfoil simulation, where an Actor can have multiple airfoils (wings, rudders, sails, keels) attached to them. Each airfoil calculates lift and drag relative to the flow around it and provides a Force and a Location to apply that force. Each airfoil has it’s own properties that determine Drag and Lift coefficients, including a reference to an associated bone to determine Angle of Attack… Each airfoil must access the Actor to determine it’s own world rotation and relative velocity.
I am trying to understand the implications of the various implementations
One Movement Component, N Structs
This is the way that WheeledVehicleMovementComponent handles it. There is one movement component that iterates through a struct per wheel. Each struct contains all the unique wheel or airfoil data, and points to a blueprint with further settings. It’s somehow tied up with PhysX, so it’s not clear to me that this is the best approach for a more general solution.
In my version, Movement Component Tick would iterate over each airfoil struct, and AddForceAtLocation for each, or do it’s own force summation and apply forces and torques once.
N Movement Components
This would be one movement component per airfoil, each applying AddForceAtLocation in it’s own Tick.
A Blueprint Library Function
No movement component, just a static C++ function for computing force and location. The forces would be applied in the Actor Blueprint…
Naively, option 2 (N Movement Components) seems the simplest to implement and most manageable for a Blueprint user. Option 1 might be better if I intend to have some sort of damping or “fly by wire” system where the MovementComponent adjusts the forces to make the vehicle more manageable. I can’t see any advantages to option 3, other than being the least “black box”
Any thoughts from more experienced Unreal users?