C++ climbing and vaulting system

The nice part of programming is there really isn’t a wrong way to do it. There are only more efficient ways of handling things. I personally would go with the idea of a volume-box that recognizes an actor in the area so long as a particular button is held.

I believe this to be much more modular due to the fact that you could scale it in any way you wanted or shape it to specific ledges. The down-side to it is you’ll want to place this on every conceivable ledge so for procedural generated terrains and maps you’re going to run into an issue.

Whether you use a mesh or actor or honestly anything so long as it fits your needs then it doesn’t really matter in the end.

Here is a quick RayTrace example to get the name of an actor. Simply use this function and name the actor whatever you want in the editor. This way if you can just make one, copy and paste it over and over and shape it however you’d like. This should help to get you started.

((P.S don’t mind the messiness of the code! Organize it how you’d like. ))



FString * AProjectX2Character::GetName()
{

	FVector CameraLoc;
	FRotator CameraRot;
	GetActorEyesViewPoint(CameraLoc, CameraRot);


	FVector StartTrace = CameraLoc;
	FVector EndTrace = CameraLoc + (CameraRot.Vector() * 5000);


	static FString testString;

	FCollisionQueryParams TraceParams
		(
		FName(TEXT("GetName")),
		false,
		this
		);

	FHitResult HitResult;

	if (GetWorld()->LineTraceSingle(HitResult, StartTrace, EndTrace, ECC_Visibility, TraceParams))
	{

		AActor * ActorTest;


		if (HitResult.GetActor())
		{
			ActorTest= HitResult.GetActor();


			if (HitResult.GetActor()->GetName() == "TestingName")
			{
				testString = HitResult.GetActor()->GetName();
			}

			else
			{
				testString = FString("Nothing");
			}

		}

		else
		{
			testString = FString("Not an Actor");
		}

		GEngine->AddOnScreenDebugMessage(-1, 5.0, FColor::Red, FString::FString(testString));


		DrawDebugLine
			(
			GetWorld(),
			StartTrace, // Start Trace
			HitResult.Location, // Hit Result Location
			FColor(255, 0, 0), // Red
			false, // Persistent Lines
			5.0, // Time
			0, // Depth Priority
			5.0 // Thickness
			);
	}

	return & testString; // return the address 
}



Great!!! Thanks for the code Master Kyp, it will be very helpful, I’ll give it a try, although it would be awesome to create a procedural climbing and vaulting system like 's one, in case someone is interested, we could team up to make it real. thanks for all the help and advices!!

My system detects your number one concern, , as you can see here: https://www.youtube.com/watch?v=1TjnWZhGyG8#t=173 ( minute 2:55 )

Aragonath, you could wait a little more and grab a copy of my system, and convert must of it to C++. :wink:

Thanks !!! I’ll study your system as soon as get a copy, and share my progress here :slight_smile: