How to use GASP with Custom Gravity in UE5.6

Im trying to use CustomGravity in GASP. I’m new to Unreal Engine, the first problem that occurred was that the character’s upper body remained perpendicular to the Z-axis. I found that the problem is caused by the OffsetRootBone node, while using the Accumulate mode, I use the Transform (Modify) Bone node to perform root bone rotation repair. It seems that PoseSearchSchema Trajectory Channel does not support custom gravity unnormal axis.Did I overlook something, or do I need to customize it

I don’t know what happened, but I messed around and came up with a formula that seems to be correct.

FVector BoneDelta = AnimInstance->GetOwningActor()->GetActorTransform().GetRelativeTransform(SearchContext.GetWorldBoneTransformAtTime(SampleTimeOffset, SampleRole, SchemaBoneIdx)).InverseTransformVector(BonePosition);
float t = BoneDelta.X;
BoneDelta.X = -BoneDelta.Y;
BoneDelta.Y = t;

Im trying to do something similar, being able to vault/mantle etc why the gravity is changed, using the traversal blocks from the same project.

I don’t use C++ but i can’t find where the rotation should happen. I’ve changed the default up vector on the traversal blocks to match the gravity change - but the trace from the character doesn’t act the same as when it’s using default gravity.

Any ideas?

There are many rotations and vector calculations that need to be changed in ABP and CBP. In addition to blueprints, it is also necessary to have capsule collisions that allow rotation (rotation is not supported by default) for correct climbing, as well as to customize the action prediction calculation method for channels in PoseSearchSchema. I have achieved what I want now, but only blueprint may not be able to do it, for Channel,may be you can try using blueprint inheritance PoseSearchFeatureChannel_* class, I am not sure

I’ve been trying to solve this issue as well. Thank you for making this post! Did you input this code into the ABP or CBP to fix this issue?

I switched to building the engine from Github source code and added this code to line 1074 of the engine plugin PoseSearchContext.cpp. This may not be correct, but it works…

FVector Pos = RootBoneTransform.InverseTransformPosition(SampleBoneTransform.GetTranslation());
if (const UAnimInstance* AnimInstance = Cast<UAnimInstance>(GetContext(SampleRole)->GetFirstObjectParam()))
{
	FTransform actorTRS = AnimInstance->GetOwningActor()->GetActorTransform();
	FVector BoneDelta = actorTRS.GetRelativeTransform(RootBoneTransform).InverseTransformVector(Pos);
	Pos = FVector(-BoneDelta.Y, BoneDelta.X, BoneDelta.Z);
}
return Pos;

Thanks for the details! I’ve been trying to get this to work today. Got it to compile correctly but still having issues getting my GASP animations to not be glitchy. It could be my custom gravity blueprint. How are you calculating the surface normal? Attached my blueprint can also send you the cpp if thats more helpful. Thanks again for assisting me. This has been such a headache of an issue.

EDIT:
Worth mentioning I’m running latest ue5.6.1 and updated GASP when 5.6 came out. Could be some slight changes between our versions possibly.

EDIT EDIT:
Pinpointed the Error to be something with the foot placement.

Assertion failed: !PelvisTransformCS.ContainsNaN() [File:D:\build++UE5\Sync\Engine\Plugins\Animation\AnimationWarping\Source\Runtime\Private\BoneControllers\AnimNode_FootPlacement.cpp] [Line: 1248]