Physics Units

Just posting this to save anyone else having to look for it and me having to look for it when I forget it.

Units used by PhysX in Flax
Length: cm
Mass: kg
Force: N
Time: s

Giving velocities in cm/s, accelerations in cm/s/s etc. Particular care will be required manually setting moments of inertia, which will be in^4 (vehicle models).

The physics scales are defined in FlaxEngine/Source/Engine/Physics/PhysX/PhysicsBackendPhysX.cpp
Search for PxCreatePhysics


That’s right! More docs about world units and coordinates: World Units | Flax Documentation

1 Like

About vehicle models,

I am a little bit confused with the units so if we have an engine with the following profile

410 Nâ‹…m (302 ftâ‹…lbf) @ 8000 rpm
What data should we input into the vehicle models in order to be compatible in flax?

Also the colliders on the objet is in cm because it is in the editor unit, however the the tooltip on the size and radius of the wheels are asked to be entered in metres however if if enter in metres, the collision is too small and it seems that cm are also required here, can someone kindly advise ?

finally, is there a cylinder collider somewhere to match better a shape of a wheel than a sphere?

I don’t know how the vehicle model is constructed in Flax, if it feeds its numbers directly (unscaled) into PhysX, as I would expect, then your 410 Nm will be 41000 Ncm of torque. I would assume the tool tip is in error and the radius needs to be in cm. Having any sort of in editor scaling of units in addition to the PhysX scale would be highly confusing to say the least.

Don’t use an additional collider for the wheel physics, that should be taken care of by the PhysX wheel collider, you can then just put a visual representation over that.

Thank you, I will give a try…regarding the collider on the wheels, I understand the wheel vehicle PhysX will take care of it based on the data we entered and no from the physical shape, however will the sphere colliders have any influences with other parts of the world colliders or they will not be processed ?

Thank you, I am not sure why cylinder shape is not a primitive in Flax actually :slight_smile:

It is not a primitive because it is not a primitive in PhysX. Maybe someone could add it, but it will not give the same performance because it will be a custom PhsyX shape.

1 Like

Ok I could setup everything right however I am suspecting something 32 bits float jittering issues (precision maybe because of 1 unit = 1 cm and not 1m) if I am driving too far, so what would be the safest zone range if we want to have camera / physics for the car working smoothly in flax? Is there some guideline somewhere ?

When I did my test, I modeled a cylinder shape in blender that closely wrapped my wheels. In Flax you can build custom collision shapes as a Collision Data object.

Damn it…accidentally deleted post above.

Actually the colliders set for the wheels physics do not collide with anything, they only contact with raycast for the ground so if we want to have like real wheels colliding with a wall for example then I am afraid we need extra colliders unless I am missing something, of course I will make further test but this is what I am seeing here…

Hey, sorry I’ve been offline. Yes the PhysX wheel colliders are not real colliders, they are physics objects that either ray cast or shape cast looking for the ground. So you are correct, they won’t pick up lateral collisions etc. However, take care with putting an actual collider on the wheel - if it prevents a possible ground contact (e.g. collides with a feature before the ray cast) then it will interfere with the physics forces calculated by the wheel collider.

If you want to pick up other interactions, e.g. someone shooting at the wheels, use a conventional collider, but make sure it is significantly smaller than the wheel collider. If possible use layer masks to avoid unwanted contact risks.