Hi
I had to make a local change to get smooth movement on the player for our project. Using a (quite big) spherical world seems to make the delta between old-new gravity directions too big to get a smooth transition .
Therefor I had to disable the return statement in ninjacharacter.cpp (which sets the control rotation).
Also added a rotator lerp in the movementcomponent (that still has the return statement a few lines prior).
Do you think will have a huge impact on performance eventually? If so, what would you recommend to smoothen out the (rotational)movement? Using camera lag smoothens it out a little, but not entirely (and we rather don’t have much lag on the camera)
NinjaCharacter.cpp line 223:
if ((LastAxisZ | NewAxisZ) >= THRESH_NORMALS_ARE_PARALLEL)
{
//return;
}
NinjaCharacterMovementComponent.cpp line 5380:
// Abort if angle between new and old capsule 'up' axes almost equals to 0 degrees
if ((DesiredCapsuleUp | CurrentCapsuleUp) >= THRESH_NORMALS_ARE_PARALLEL)
{
return;
}
//// Take desired Z rotation axis of capsule, try to keep current X rotation axis of capsule
const FRotator NewRotation = FNinjaMath::MakeFromZQuat(DesiredCapsuleUp,
UpdatedComponent->GetComponentQuat()).Rotator();
**const FRotator CurrentRotation = FNinjaMath::MakeFromZQuat(CurrentCapsuleUp,
UpdatedComponent->GetComponentQuat()).Rotator();**
if (!bRotateAroundCenter)
{
float PawnRadius, PawnHalfHeight;
CharacterOwner->GetCapsuleComponent()->GetScaledCapsuleSize(PawnRadius, PawnHalfHeight);
// Rotate capsule around the origin of the bottom sphere
const float SphereHeight = PawnHalfHeight - PawnRadius;
const FVector Delta = CurrentCapsuleUp * (SphereHeight * -1.0f) + DesiredCapsuleUp * SphereHeight;
**FRotator RotationLerp = UKismetMathLibrary::RInterpTo(CurrentRotation, NewRotation, GetWorld()->GetDeltaSeconds(), 4.0f);**
// Not using MoveUpdatedComponent to bypass constraints
UpdatedComponent->MoveComponent(Delta, **RotationLerp**, true);
}
nonetheless, nice work on the update!! Especially the new debug options are really useful!