コード例 #1
0
    protected override void Initialise2(IntPtr world)
    {
        Vector3 anchorA = transform.position - BodyA.transform.position;
        Vector3 anchorB = transform.position - BodyB.transform.position;

        ThingPtr = LPAPIJoint.CreateWheelJoint(world, BodyA.GetComponent <LPBody>().GetPtr(), BodyB.GetComponent <LPBody>().GetPtr()
                                               , anchorA.x, anchorA.y, anchorB.x, anchorB.y, Axis.x, Axis.y, CollideConnected);

        LPAPIJoint.SetWheelJointSpringFrequency(ThingPtr, SpringFrequency);
        LPAPIJoint.SetWheelJointSpringDampingRatio(ThingPtr, SpringDampingRatio);
        if (HasMotor)
        {
            LPAPIJoint.EnableWheelJointMotor(ThingPtr, HasMotor);
            LPAPIJoint.SetWheelJointMaxMotorTorque(ThingPtr, MaxMotorTorque);
            LPAPIJoint.SetWheelJointMotorSpeed(ThingPtr, MotorSpeed);
        }
    }