I do all stuff via BP, but time calculation for animation start of course required a c++. It’s a root cause of all my problems now ))) but I get close to finish. I need more time and tests. I have a plan for sharing my solution via git repo in the future.
Imagine that I was in your place 2 years ago and now I work as a c ++ programmer in gamedev.
Attitude is everything and impossible is nothing.
I am from Poland btw.
I think I finished a “GetCurveTime” blueprint function implementation. I hope so)
Does anybody knows how achieve this?
I mean, show the Error message on Compile if necessary pins are empty? I used “UPARAM(ref)” but it looks ugly (see screenshot above), it disables Anim Sequence choice menu. I want to make all pins are mandatory.
Do you want to have choice menu of Anim Sequences to select?
Yep. BP Node should looks like this:
This requires to removing UPARAM(ref) from function declaration, but I still want to make all pins are mandatory and show the Error message on Compile if they are empty
Did you manage to do that?
I mean that choice menu option.
Nope. This is default behavior for function argument of type UAnimSequence.
UFUNCTION(BlueprintPure, Category = "Animation")
static float GetCurveTime(UAnimSequence *AnimationSequence, FName CurveName, float CurveValue);
I want to make all 3 arguments are mandatory, but I don’t know how.
Why do you want that?
Because showing error on compile time is better than just log it or crash UE Editor). I just want the same logic as in GetCurveValue BP node. Anyway, I should concentrate on more important things)
How’s it going?
I started a new project for recreating all my previously created features in c++. And I playing with the new Rider for Unreal Engine by JetBrains team! It’s awesome!
Just look this:
It looks interesting.
Just dropping a hint:
.h
UFUNCTION(BlueprintCallable, Category = "Ocean Wave Functions")
FVector GetWaveHeight(FVector Location, float Time, UAnimSequence *AnimatioNSequence);
.cpp
FVector AC_Ocean_Actor::GetWaveHeight(FVector Location, float Time, UAnimSequence *AnimatioNSequence)
I literally just pasted it into whatever function I had open, mind you.
Using
#include "Animation/AnimSequence.h"
at the header of .h
Your function is Pure, but it shouldn’t make much of a difference if your pointer reference and #include are correct.
I don’t have a problems with “Animation/AnimSequence.h” importing) I want to know how to prevent runtime error in case of incorrect using pins in BP node and show the error message on compile time of BP. UE_LOG doesn’t resolve this problem and shows error messages only in runtime. The best practices is show error messages at BP compile time, it’s more user friendly for game designers and other non programmers.
All you have to do is validate your value within the function. Old school.
the difference is you cannot set the pointer for the animation sequence to a pre-set, it needs a specific input or selection to work.
As such you cannot make the node “just work” without giving the user an error when he doesn’t connect it to the correct data - or select the animation sequence.
within the function, check if any of the variables are null, if they are, return a custom error.
since you are also outputting a float in your case, you may want to return that value as 0 or -1 depending on what fits the usage.
UE_LOG(Fatal, would cause the blueprint compiler to stop and report an error I believe.
There are some pre built macros you can also use in
Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h
other then that, it’s really up to the end user to make sure they use your functions correctly…
I finished with prediction for stopping, apex and landing locations. All predictions are made via C++. Also I made a function for extracting time from curve by distance value. It’s a little bit tricky and require to use something like a binary search. I’m not shure about quality of my C++ code, but it’s working And… I got stuck on animation blending and transition rules for locomotion states.
Did You set ground frition, acceleration and deceleration values?
Keep going.
Yep, I using this parameters for character movement:
Can you describe or share how do you make transition from jog\walk stop to Idle state? Root cause of my problem is evaluating of stop animation, it stops when my character is reached the stop position. Animation like “jog left stop” doesn’t fit the idle animation at first 0 distance value on curve and needs to play a bit longer until match the character position in Idle animation for smooth blending between them.
@ I have sent You pm.