Hello! I am new here, is this the place to post such shtuff?
The Docs and tutorials for this engine and the community itself is really good, but I noticed an aspect that is particularly missing from both the Wiki and the general tutorials around the web - how to make different UE4 systems work together. This concerns pretty much all the systems (e.g. using particles with dynamic gameplay objects, as in using some logic/vars from the object to control particle and vice versa), but the one I am particularly interested in and one I think would be most useful is C++ AND Blueprints. It appears that the best way to make any sort of full project in UE4 is by combining C++ code with blueprints to keep the BP tidy, while still using their dynamic non-hard-coded values in your game. So here is my feature suggestion, I think it would be a great help if someone explain how to do this:
Use case:
Making a dynamic character controller with Aim Offsets and Blend Spaces. I want to have a character controller where Basic firing, movement and vector calculation logic is initialized in C++ and used in Blueprints (e.g. Spawn the Camera boom and set it’s initial values in C++, configure in Blueprints, Calculate Direction, Speed and AimOffset vectors in C++, use in Blueprints, Write AI reactions such as running towards target, attacking target, hiding and so on in C++, use BP to define when these reactions should occur etc.).
For the scope of tutorial I think just Aim Offset calculation would suffice.
**Workflow:
**
- Create a AimOffset(target=self) function in C++ that targets the BP called by default, but can have custom target, similar to for example “Get Control Rotation” node from animation blueprints.
- Make it visible to blueprints
- Use it to replace the following node set:
BP function spec:
Pawn > Calculate Aim Offset
Inputs:
Pawn/Character Target - The Pawn for which to calculate Offsets, self by default
Interp speed - Speed at which to interpret rotation delta
Delta time - time function to use for interpreting (let’s say I am building an AI - I don’t want it to be frame-dependent or I will get Mass Effect 3 Multiplayer syndrome)
Clamp range - Maximum values supported by Offset animations
Outputs:
Pitch: AimOffset clamped pitch value ready to be set to the animation variable
Yaw: AimOffset clamped yaw value ready to be set to the animation variable
[Optional] Orientation - by own personal preference - the bottom set of nodes calculate character orientation Yaw and if AimOffset Yaw reaches certain threshold rotates the whole character. I would put it on every character (even turrets, I just wouldn’t use it), so I would like it to be included in the function too, just as a good practice.
Result:
After the tutorial the person following it should know how to make a function, expose it to all blueprints, and have configurable inputs, to greatly compress the blueprint construction. As you saw from the screenshot, in Blueprints, this very commonly used functionality takes quite a lot of nodes. If I was to program also the AI behaviour or gameplay mechanics completely in Blueprints, it would make them insanely huge and unreadable. It makes much more sense to create functions for things like AI that are responsible for processing data in C++ (e.g. calculate target, calculate where cover is, enter cover, swap weapons) and then use BP to define conditions for when these actions are performed.
As a small suggestion for Documentation: it would help A LOT if the Blueprint reference in UE docs also told of the equivalent or related C++ functions for the node. E.g. something like this:
I think this would be a very useful tutorial, please excuse me if there already is one for this, I haven’t been able to find any.