예제 #1
0
 private IEnumerator UpandDown()
 {
     while (true)
     {
         if (Random.Range(0, 2) == 1)
         {
             LPAPIJoint.SetPrismaticJointMotorSpeed(joint.GetPtr(), Random.Range(-3f, 3f));
         }
         yield return(new WaitForSeconds(2f));
     }
 }
예제 #2
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);
        }
    }