예제 #1
0
    protected override void Initialise2(IntPtr world)
    {
        getbackfor();
        RotateTranslation();

        Vector3 anchorA = transform.position - BodyA.transform.position;
        Vector3 anchorB = transform.position - BodyB.transform.position;

        ThingPtr = LPAPIJoint.CreatePrismaticJoint(world, BodyA.GetComponent <LPBody>().GetPtr(), BodyB.GetComponent <LPBody>().GetPtr()
                                                   , anchorA.x, anchorA.y, anchorB.x, anchorB.y, Translation.x, Translation.y, CollideConnected);
        if (HasMotor)
        {
            LPAPIJoint.EnablePrismaticJointMotor(ThingPtr, HasMotor);
            LPAPIJoint.SetPrismaticJointMaxMotorForce(ThingPtr, MaxMotorForce);
            LPAPIJoint.SetPrismaticJointMotorSpeed(ThingPtr, MotorSpeed);
        }

        if (HasLimits)
        {
            LPAPIJoint.EnablePrismaticJointLimits(ThingPtr, HasLimits);
            LPAPIJoint.SetPrismaticJointLimits(ThingPtr, LowerLimit, UpperLimit);
        }
    }