Vector Projection

Hello,

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.

Also, a bug I have found, is that my vehicle flies, depending on it’s forward facing direction. for example, if the nose is facing up, and the user presses the W button, the vehicle will fly.

Can someone please tell me what function in the FVector class I will need to use, I have tried my own implementation but I have gotten know where.



	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);


This code doesn’t change anything.