Announcement

Collapse
No announcement yet.

[New Wiki] Create custom Hand Crafted Cubic Curves in Editor for Use in C++

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [New Wiki] Create custom Hand Crafted Cubic Curves in Editor for Use in C++

    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









    ~~~

    .H

    Code:
    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

    Code:
    //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

    https://wiki.unrealengine.com/Curves...or_Use_In_Code


    Enjoy!

    Rama
    Last edited by Rama; 08-31-2014, 06:15 PM.
    UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

    ♥ Rama
Working...
X