Trying to write custom gravity but isn't behaving as I want to.


I am writing basic custom physics that also partially work with the engine (it’s for a school assignment and i need to score some points on complexity :o). I started with gravity but it isnt working as I expected. Im probably missing something, can someone point me in the right direction?

my tick looks like this

void APhysicsObject::Tick(float DeltaTime)
//The earths gravitational pull is 980,7cm/s^2
gravPull += 981 * FApp::GetFixedDeltaTime();
FVector gravForce = FVector(0.f, 0.f, -1.f) * gravPull;
UE_LOG(LogTemp, Warning, TEXT(“total %f”), gravPull);

Then when the object hits the ground I set the gravPull to 0. I know it isnt the cleanest way but I thought this would save me some performance.