I am facing a problem with my "hover" vehicle. I only want it to move when it is on the ground.
I have come across vector projection, projecting one vector on to another vector.
With this my vehicle will be able to go down ramps with acceleration, and up ramps, and alley oops, curved ramps ETC.
However, this is all theory to me.
Unreal Four Engine doesn't have a Vector on Vector static function in the API, or maybe I am wrong FVector
For now, I have implemented this.
FVector test = FVector::VectorPlaneProject(StaticMeshComponent->GetForwardVector(), surfaceImpactNormal);
FVector surfaceForwardDirection = StaticMeshComponent->GetForwardVector() - test;
FVector force = (surfaceForwardDirection* m_forwardAcl) * AxisValue;
force = force * GetWorld()->DeltaTimeSeconds * StaticMeshComponent->GetMass();
StaticMeshComponent->AddForce(force);
My aim is to get something like in the picture:
Is there anyway I can get my vehicle to accelerate back and fourth with out flying off into the sun set (if it's nose is pointing at that angle).
The FVector
you are using has a method to project one vector onto another one: FVector::ProjectOnTo
In your case you would call it like this:
FVector UprojectedOnV = U.ProjectOnTo(V);