Пример #1
0
        public void GetWheelTransform(int unitIndex, int axleIndex, int axleSide, ref Vector3 position, ref Quaternion rotation)
        {
            if (IntPtr.Zero != VsVehicleHandle)
            {
                Check(VS_Vehicle.IsValidVehicle(VsVehicleHandle));

                if (VS_Vehicle.IsOk(VsVehicleHandle))
                {
                    double forward = 0;
                    double left    = 0;
                    double up      = 0;

                    double rollRightRad = 0;
                    double pitchDownRad = 0;
                    double yawLeftRad   = 0;



                    VS_Vehicle.GetTireWorldPosition(VsVehicleHandle, unitIndex, axleIndex, axleSide, ref forward, ref left, ref up);
                    VS_Vehicle.GetTireWorldOrientation(VsVehicleHandle, unitIndex, axleIndex, axleSide, ref rollRightRad, ref pitchDownRad, ref yawLeftRad);

                    position = VsUnityLib.VSToUnityVector(forward, left, up);
                    rotation = VsUnityLib.VSToUnityRotation(rollRightRad, pitchDownRad, yawLeftRad);

                    //Log(rollRightRad + "," + pitchDownRad + "," + yawLeftRad);
                    //CarSim_UnityLib.SetUnityTransformFromSolverValues(wheelGameObject, (float)forward, (float)left, (float)up, (float)rollRightRad, (float)pitchDownRad, (float)yawLeftRad);
                }
            }
        }