Exemplo n.º 1
0
        public void Create_Hinge(string type, AgX_Frame left, AgX_Frame right, double lowerLimit, double upperLimit)
        {
            this.type = type;

            //Hinge is locked between the two objects.
            hinge_Frame.setCenter((left.GetAgxObject().getPosition() + right.GetAgxObject().getPosition()).Divide(2));
            if (left.GetRotation().x == 0)                  //pitch or yaw module
            {
                hinge_Frame.setAxis(new agx.Vec3(1, 0, 0)); //axis along the x direction
            }
            else
            {
                hinge_Frame.setAxis(new agx.Vec3(0, 1, 0)); //axis along the x direction
            }
            joint = new agx.Hinge(hinge_Frame, left.GetAgxObject(), right.GetAgxObject());

            joint.asHinge().getMotor1D().setEnable(true);
            joint.asHinge().getRange1D().setEnable(true);

            joint.asHinge().getRange1D().setRange(lowerLimit, upperLimit);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Finds constraint type given native instance.
 /// </summary>
 /// <param name="native">Native instance.</param>
 /// <returns>ConstraintType of the native instance.</returns>
 public static ConstraintType FindType(agx.Constraint native)
 {
     return(native == null ? ConstraintType.Unknown :
            native.asHinge() != null ? ConstraintType.Hinge :
            native.asPrismatic() != null ? ConstraintType.Prismatic :
            native.asLockJoint() != null ? ConstraintType.LockJoint :
            native.asCylindricalJoint() != null ? ConstraintType.CylindricalJoint :
            native.asBallJoint() != null ? ConstraintType.BallJoint :
            native.asDistanceJoint() != null ? ConstraintType.DistanceJoint :
            native.asAngularLockJoint() != null ? ConstraintType.AngularLockJoint :
            native.asPlaneJoint() != null ? ConstraintType.PlaneJoint :
            ConstraintType.Unknown);
 }
Exemplo n.º 3
0
        public void Create_Hinge(string type, AgX_Frame left, AgX_Frame right, double leftLimit, double rightLimit)
        {
            this.type = type;

            //Hinge is locked between the two objects.
            hinge_Frame.setCenter((left.GetAgxObject().getPosition() + right.GetAgxObject().getPosition()).Divide(2));
            if (left.Get_Rotation().x == 0)
            {
                hinge_Frame.setAxis(new agx.Vec3(1, 0, 0)); //axis along the x direction
                //UnityEngine.Debug.Log("z in agxint: " + left.Get_Rotation().x);
            }
            else
            {
                hinge_Frame.setAxis(new agx.Vec3(0, 1, 0)); //axis along the x direction
            }
            Joint = new agx.Hinge(hinge_Frame, left.GetAgxObject(), right.GetAgxObject());
            //Joint.asHinge().getLock1D().setEnable(true);
            Joint.asHinge().getMotor1D().setEnable(true);
            Joint.asHinge().getRange1D().setEnable(true);
            //Might want to have this as a modifyable parameter:
            Joint.asHinge().getRange1D().setRange(leftLimit, rightLimit /*-Math.PI / 2, Math.PI / 2*/);

            //Joint.asHinge().getMotor1D().setSpeed(0.2f);
        }
Exemplo n.º 4
0
 public double GetAngle()
 {
     return(joint.asHinge().getAngle());
 }