I have edys roll bar code

And I'm trying to find the value of travelL and travelR

I have wheels attached to to axles (a cube scaled 0.5x) attached to a car body with physics constraints inbetween (the wheel -> axle physics constraint handles the suspension and the rotation of the wheel, the 2nd physics constraint just attaches the 'axle' to the body). So I tried the InverseTransformPosition node divided by the wheels radius (37.5cm) at the Hit.Location -> OnComponentHit(WheelRearRight)

I'm trying this and just getting a value from -2 to 0 and back at a frequency that increases linearily with the rate of the wheel rotating.

The WheelL.radius is easy thats 37.5cm and the wheelL.SuspensionDistance is easy thats also 37.5 but "-WheelL.transform.InverseTransformPoint(hit.point).y" confuses me other than .y would be the Z axis in UE4.

How do I go about applying an InverseTransformPoint to a hit event on a meshes transform?

I can upload the project if need be.

Thanks.

Edit: I think I got it working the car definitly doesnt want to roll as easy but I have no idea if its right I'm taking the above and just simply taking the hit location / 37.5 (wheel radius) then multiplying by antirollforce (5) and then adding that force (straight float to vector conversion have to figure out what axis to add it to) and adding the force at the up vector of the axle physics cosntraint since it doesnt move at all in relation to the body.

Code:

var WheelL : WheelCollider; var WheelR : WheelCollider; var AntiRoll = 5000.0; function FixedUpdate () { var hit : WheelHit; var travelL = 1.0; var travelR = 1.0; var groundedL = WheelL.GetGroundHit(hit); if (groundedL) travelL = (-WheelL.transform.InverseTransformPoint(hit.point).y - WheelL.radius) / WheelL.suspensionDistance; var groundedR = WheelR.GetGroundHit(hit); if (groundedR) travelR = (-WheelR.transform.InverseTransformPoint(hit.point).y - WheelR.radius) / WheelR.suspensionDistance; var antiRollForce = (travelL - travelR) * AntiRoll; if (groundedL) rigidbody.AddForceAtPosition(WheelL.transform.up * -antiRollForce, WheelL.transform.position); if (groundedR) rigidbody.AddForceAtPosition(WheelR.transform.up * antiRollForce, WheelR.transform.position); }

I have wheels attached to to axles (a cube scaled 0.5x) attached to a car body with physics constraints inbetween (the wheel -> axle physics constraint handles the suspension and the rotation of the wheel, the 2nd physics constraint just attaches the 'axle' to the body). So I tried the InverseTransformPosition node divided by the wheels radius (37.5cm) at the Hit.Location -> OnComponentHit(WheelRearRight)

I'm trying this and just getting a value from -2 to 0 and back at a frequency that increases linearily with the rate of the wheel rotating.

The WheelL.radius is easy thats 37.5cm and the wheelL.SuspensionDistance is easy thats also 37.5 but "-WheelL.transform.InverseTransformPoint(hit.point).y" confuses me other than .y would be the Z axis in UE4.

How do I go about applying an InverseTransformPoint to a hit event on a meshes transform?

I can upload the project if need be.

Thanks.

Edit: I think I got it working the car definitly doesnt want to roll as easy but I have no idea if its right I'm taking the above and just simply taking the hit location / 37.5 (wheel radius) then multiplying by antirollforce (5) and then adding that force (straight float to vector conversion have to figure out what axis to add it to) and adding the force at the up vector of the axle physics cosntraint since it doesnt move at all in relation to the body.