Dear Community,
I’ve just posted a new wiki tutorial that shows you how you can hand-craft cubic curves in the editor to then use them to drive physics animations or any other custom C++ mechanic!
So what I am showing you is how you can easily create custom spring dampen curves, or fall off curves, or literally any shape curve you want, with the complete ease of UE4’s visual curve editor, and then use the custom curves you create in UE4 C++ to drive any game mehcanics you want!
**Pics**
https://d26ilriwvtzlb.cloudfront.net/b/b7/CurveFinal.jpg
https://d26ilriwvtzlb.cloudfront.net/d/db/MiscCurve.jpg
https://d3ar1piqh1oeli.cloudfront.net/e/e4/CurveAuto.jpg/1050px-CurveAuto.jpg
https://d3ar1piqh1oeli.cloudfront.net/6/6c/CharBP.jpg/1050px-CharBP.jpg
.H
UCLASS()
class AYourCharacter : public ACharacter
{
GENERATED_UCLASS_BODY()
/** Joy Curve */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="JoyCurve")
UCurveFloat* JoyCurve;
//Rama's Draw Point wrapper
FORCEINLINE void DrawPoint
(
const FVector& Loc,
const float Size = 7,
const FColor& Color = FColor::Red,
const float Duration=-1.f
) const {
DrawDebugPoint(
GetWorld(),
Loc,
Size, //thickness
Color,
false,
Duration
);
}
**CPP**
```
//Tick
void AYourCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
//~~~~~~~~~~~~
//~~~ Draw the Curve! ~~~
if(JoyCurve)
{
for(float v = 0; v < 1; v+=0.01)
{
DrawPoint(GetActorLocation() + FVector(v * 128,0,128 * JoyCurve->GetFloatValue(v)) );
}
}
else
{
//UE_LOG "Joy CURVE IS INVALID!!!!";
}
}
```
Wiki Tutorial
Enjoy!
Rama