Okay so I’m having difficulty getting this to work. I think I’m missing something important. Here’s the code: (Also I don’t know how to paste code to make it look nice so sorry)
//World to Component Method
FVector UCharacterMovementComponent::hkvWorldToComponent(FVector VectorToRotate)
{
FTransform compToWorldTrans = CharacterOwner->CapsuleComponent->ComponentToWorld;
FVector rotatedVector = compToWorldTrans.InverseTransformVectorNoScale(VectorToRotate);
return rotatedVector;
}
/*Do Jump, Here I'm not using the method(Though I would like to) this works in getting the jump to be along the character capsule's upvector. */
Velocity += CharacterOwner->GetActorUpVector() * JumpZVelocity;
/*PhysFalling section, changing this line to use the character capsule's up vector will work but I think it would be best to just rotate the vector so I can always use the Z is up logic */
Velocity = NewFallVelocity(Velocity, hkvWorldToComponent(FVector(0.f, 0.f, GetGravityZ())), timeTick);
When I runt game, the character will jump up along capsules UpVector so that approach works, but once when the game starts the character falls from a height (so I can check that he’s falling along his UpVector) Using the inverse rotated Vector the character falls along the World “Z”. This is what I’m trying to avoid.