I’m new to Unreal engine and i’m having some issues with vehicle physics. I’m trying to add an external force to a vehicle (force vector relativ e to vehicle) by
FVector testvect = UpdatedComponent->GetBodyInstance()->GetUnrealWorldTransform().TransformVectorNoScale(CurrentThrust);
where CurrentThrust is the force vector i want to add and UpdatedComponent is the skeletal mesh.
This works great if the vehicle is already in motion, or not touching the ground. But if the wheels are on the ground and the vehicle is standing still nothing happens!
Another issue i’m having, which could be related, is that i have to add very large forces, e.g. 1 000 000 , and if i want it to brake i need to use a brake torque of 15 000 000. I read somewhere that the unit is Ncm and not N, but it still seems large? The mass of the vehicle is 750 kg and the wheel masses are 20 kg each.
I wonder how do you calculate ThrustForce? Does it depend from time? Do you apply this function in Tick? Do you disable this force when you brake?
We have seen this issue with addForce function and it looks like this force resist with wheels when vehicle stay on the ground, so we will make some tests about this problem. Try to use SetAllPhysicsLinearVelocity instead of addForce.
UpdatedComponent->SetAllPhysicsLinearVelocity(velScale * GlobalForwardVector, true);
Thanks for the answer!
Yes, I add the force during tick. The whole story is a bit more complicated than i explained in the previous post though, I’m sorry for being a bit vague earlier.
My goal is to create an aircraft model based on the vehicle system. What i’ve done is that i’m still using the vehicle manager in the unreal engine source but i’ve added a new vehicle type using the PxVehicleNoDrive physx class to get rid of the engine, transmission, etc, overhead and to allow me to use only 3 wheels. I use the SetBrakeTorque method to apply brake wheel brake torque and I use add force to add the aerodynamic and thrust forces to the body at the right locations. To answer your other question: I do continue to apply the forces even when i brake due to what they represent.
I solved the issue described in the previous post by setting a very small drive torque with setDriveTorque. Not a great solution but it works (even if the drive torque is not enough to actually move the vehicle noticeable. It would, however, be good to figure out the underlying cause.