public VehicleWheel( WheelCollider vehicleWheel, WheelComponent wheelComponent, WheelPosition frontRear, WheelPosition leftRight ) { wheelFrontRear = frontRear; wheelLeftRight = leftRight; checkCurrentWheelState = WheelsOnGround.WHEEL_ON_GROUND; mainWheelCollider = vehicleWheel; wheelPhysicsComponent = wheelComponent; visualWheel = vehicleWheel.GetComponentInChildren<MeshRenderer>( ).transform; wheelRadius = ( visualWheel.GetComponent<Renderer>().bounds.size.y / 2 ); mainWheelCollider.radius = wheelRadius; mainWheelCollider.GetGroundHit( out wheelGroundContactPoint ); }
public void AddWheel(TrainWheel wheel, WheelPosition position) { Wheels[position] = wheel; wheel.transform.SetParent(transform); wheel.Wagon = this; UpdatePosition(false); }
/// <summary> /// Параметры словарем /// (SpeedPress * 10) /// </summary> /// <returns></returns> public Dictionary <string, string> GetAsParametesDictionary() { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add(OpcConsts.SpeedPress, ((int)(SpeedPress * 10)).ToString()); parameters.Add(OpcConsts.PosadkaKol, WheelPosition.ToString()); parameters.Add(OpcConsts.Instrument, Instrument.ToString()); parameters.Add(OpcConsts.BlinR, EmphasisTravers.ToString()); parameters.Add(OpcConsts.BlinL, EmphasisPlunger.ToString()); return(parameters); }
private Quaternion GetWheelRotation(WheelPosition position) { RailPathPosition wheelPosition = null; if (position == WheelPosition.FrontLeft || position == WheelPosition.FrontRight) { wheelPosition = Train.GetBackwardsPathPosition(RailPosition, WheelInset); } if (position == WheelPosition.RearLeft || position == WheelPosition.RearRight) { wheelPosition = Train.GetBackwardsPathPosition(RailPosition, Length - WheelInset); } return(Quaternion.Euler(90f, 90f + wheelPosition.Segment.Angle, 0f)); }
private Vector3 GetWheelPosition(WheelPosition position) { RailPathPosition wheelPosition = null; if (position == WheelPosition.FrontLeft || position == WheelPosition.FrontRight) { wheelPosition = Train.GetBackwardsPathPosition(RailPosition, WheelInset); } if (position == WheelPosition.RearLeft || position == WheelPosition.RearRight) { wheelPosition = Train.GetBackwardsPathPosition(RailPosition, Length - WheelInset); } Vector3 wheelCenterPosition = wheelPosition.Segment.GetWorldPositionAtDistance(wheelPosition.Distance); RailSettings railSettings = wheelPosition.Segment.Settings; float height = railSettings.TrackHeight + railSettings.PlankHeight + WheelHeight / 2; float wheelDistance = railSettings.TrackGap / 2; float wheelAngle = 0f; if (position == WheelPosition.FrontLeft || position == WheelPosition.RearLeft) { wheelAngle = wheelPosition.Segment.Angle + 90; } if (position == WheelPosition.FrontRight || position == WheelPosition.RearRight) { wheelAngle = wheelPosition.Segment.Angle - 90; } float offsetX = Mathf.Sin(Mathf.Deg2Rad * wheelAngle) * wheelDistance; float offsetZ = Mathf.Cos(Mathf.Deg2Rad * wheelAngle) * wheelDistance; Vector3 wheelOffset = new Vector3(offsetX, height, offsetZ); return(wheelCenterPosition + wheelOffset); }
public static void scroll(WheelPosition pos, int amount) { Input i = new Input(); i.Type = InputMouse; if (pos == WheelPosition.HORIZONTAL) { i.MouseInput.Flags = MOUSEEVENTF_HWHEEL; } else if (pos == WheelPosition.VERTICAL) { i.MouseInput.Flags = MOUSEEVENTF_WHEEL; } i.MouseInput.MouseData = amount * WHEEL_DELTA - 1; Input[] ia = new Input[1]; ia[0] = i; // send it off uint result = SendInput(1, ia, Marshal.SizeOf(i)); if (result == 0) throw new Win32Exception(Marshal.GetLastWin32Error()); }
public void SetUpWheel(Rigidbody carRb) { _carRb = carRb; wheelPosition = transform.parent.localPosition.z > 0 ? WheelPosition.Front : WheelPosition.Back; }
public override string ToString() { return(string.Format("[(Pressed:{0}),(Released:{1}),(Down:{2}),(Position:{3}),(Wheel:{4}),(WheelDelta:{5})", _buttonDataToString(ButtonsPressed), _buttonDataToString(ButtonsReleased), _buttonDataToString(ButtonsDown), Position.ToString(), WheelPosition.ToString(), WheelDelta.ToString())); }