예제 #1
0
    protected override void Initialise2(IntPtr world)
    {
        bool isArev = false;
        bool isBrev = false;

        if (JointA != null && JointB != null &&
            (JointA.GetType() == typeof(LPJointRevolute) || JointA.GetType() == typeof(LPJointPrismatic)) &&
            (JointB.GetType() == typeof(LPJointRevolute) || JointB.GetType() == typeof(LPJointPrismatic)))
        {
            if (JointA.GetType() == typeof(LPJointRevolute))
            {
                isArev = true;
            }
            if (JointB.GetType() == typeof(LPJointRevolute))
            {
                isBrev = true;
            }

            ThingPtr = LPAPIJoint.CreateGearJoint(world, BodyA.GetComponent <LPBody>().GetPtr(), BodyB.GetComponent <LPBody>().GetPtr()
                                                  , JointA.GetPtr(), isArev, JointB.GetPtr(), isBrev, Ratio, CollideConnected);
        }
        else
        {
            Debug.LogError("This Gear Joint must be assigned 2 Other Joints in order to be created"
                           + ", also both joints need to be a type of either LPJointRevolute or LPJointPrismatic");
        }
    }