Package com.ngt.jopenmetaverse.shared.types

Examples of com.ngt.jopenmetaverse.shared.types.Vector3


          i = 60;
          search = true;
          break;
        case 60:
          // Position
          objectupdate.Position = new Vector3(block.ObjectData, pos);
          pos += 12;
          // Velocity
          objectupdate.Velocity = new Vector3(block.ObjectData, pos);
          pos += 12;
          // Acceleration
          objectupdate.Acceleration = new Vector3(block.ObjectData, pos);
          pos += 12;
          // Rotation (theta)
          objectupdate.Rotation = new Quaternion(block.ObjectData, pos, true);
          pos += 12;
          // Angular velocity (omega)
          objectupdate.AngularVelocity = new Vector3(block.ObjectData, pos);
          pos += 12;

          break;
        case 48:
          // Collision normal for avatar
          objectupdate.CollisionPlane = new Vector4(block.ObjectData, pos);
          pos += 16;
         
          //Keep on decoding
          i = 32;
          search = true;
          break;
        case 32:
          // The data is an array of unsigned shorts
          //TODO need to handle Little Endian Data
          // Position
          objectupdate.Position = new Vector3(
              Utils.UInt16ToFloat(block.ObjectData, pos, -0.5f * 256.0f, 1.5f * 256.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 2, -0.5f * 256.0f, 1.5f * 256.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 4, -256.0f, 3.0f * 256.0f));
          pos += 6;
          // Velocity
          objectupdate.Velocity = new Vector3(
              Utils.UInt16ToFloat(block.ObjectData, pos, -256.0f, 256.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 2, -256.0f, 256.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 4, -256.0f, 256.0f));
          pos += 6;
          // Acceleration
          objectupdate.Acceleration = new Vector3(
              Utils.UInt16ToFloat(block.ObjectData, pos, -256.0f, 256.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 2, -256.0f, 256.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 4, -256.0f, 256.0f));
          pos += 6;
          // Rotation (theta)
          objectupdate.Rotation = new Quaternion(
              Utils.UInt16ToFloat(block.ObjectData, pos, -1.0f, 1.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 2, -1.0f, 1.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 4, -1.0f, 1.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 6, -1.0f, 1.0f));
          pos += 8;
          // Angular velocity (omega)
          objectupdate.AngularVelocity = new Vector3(
              Utils.UInt16ToFloat(block.ObjectData, pos, -256.0f, 256.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 2, -256.0f, 256.0f),
              Utils.UInt16ToFloat(block.ObjectData, pos + 4, -256.0f, 256.0f));
          pos += 6;

          break;
        case 16:
          // The data is an array of single bytes (8-bit numbers)
          //TODO need to handle Little Endian Data
          // Position
          objectupdate.Position = new Vector3(
              Utils.byteToFloat(block.ObjectData, pos, -256.0f, 256.0f),
              Utils.byteToFloat(block.ObjectData, pos + 1, -256.0f, 256.0f),
              Utils.byteToFloat(block.ObjectData, pos + 2, -256.0f, 256.0f));
          pos += 3;
          // Velocity
          objectupdate.Velocity = new Vector3(
              Utils.byteToFloat(block.ObjectData, pos, -256.0f, 256.0f),
              Utils.byteToFloat(block.ObjectData, pos + 1, -256.0f, 256.0f),
              Utils.byteToFloat(block.ObjectData, pos + 2, -256.0f, 256.0f));
          pos += 3;
          // Accleration
          objectupdate.Acceleration = new Vector3(
              Utils.byteToFloat(block.ObjectData, pos, -256.0f, 256.0f),
              Utils.byteToFloat(block.ObjectData, pos + 1, -256.0f, 256.0f),
              Utils.byteToFloat(block.ObjectData, pos + 2, -256.0f, 256.0f));
          pos += 3;
          // Rotation
          objectupdate.Rotation = new Quaternion(
              Utils.byteToFloat(block.ObjectData, pos, -1.0f, 1.0f),
              Utils.byteToFloat(block.ObjectData, pos + 1, -1.0f, 1.0f),
              Utils.byteToFloat(block.ObjectData, pos + 2, -1.0f, 1.0f),
              Utils.byteToFloat(block.ObjectData, pos + 3, -1.0f, 1.0f));
          pos += 4;
          // Angular Velocity
          objectupdate.AngularVelocity = new Vector3(
              Utils.byteToFloat(block.ObjectData, pos, -256.0f, 256.0f),
              Utils.byteToFloat(block.ObjectData, pos + 1, -256.0f, 256.0f),
              Utils.byteToFloat(block.ObjectData, pos + 2, -256.0f, 256.0f));
          pos += 3;

View Full Code Here


        {
          update.CollisionPlane = new Vector4(block.Data, pos);
          pos += 16;
        }
        // Position
        update.Position = new Vector3(block.Data, pos);
        pos += 12;
        // Velocity
        update.Velocity = new Vector3(
            Utils.UInt16ToFloat(block.Data, pos, -128.0f, 128.0f),
            Utils.UInt16ToFloat(block.Data, pos + 2, -128.0f, 128.0f),
            Utils.UInt16ToFloat(block.Data, pos + 4, -128.0f, 128.0f));
        pos += 6;
        // Acceleration
        update.Acceleration = new Vector3(
            Utils.UInt16ToFloat(block.Data, pos, -64.0f, 64.0f),
            Utils.UInt16ToFloat(block.Data, pos + 2, -64.0f, 64.0f),
            Utils.UInt16ToFloat(block.Data, pos + 4, -64.0f, 64.0f));
        pos += 6;
        // Rotation (theta)
        update.Rotation = new Quaternion(
            Utils.UInt16ToFloat(block.Data, pos, -1.0f, 1.0f),
            Utils.UInt16ToFloat(block.Data, pos + 2, -1.0f, 1.0f),
            Utils.UInt16ToFloat(block.Data, pos + 4, -1.0f, 1.0f),
            Utils.UInt16ToFloat(block.Data, pos + 6, -1.0f, 1.0f));
        pos += 8;
        // Angular velocity (omega)
        update.AngularVelocity = new Vector3(
            Utils.UInt16ToFloat(block.Data, pos, -64.0f, 64.0f),
            Utils.UInt16ToFloat(block.Data, pos + 2, -64.0f, 64.0f),
            Utils.UInt16ToFloat(block.Data, pos + 4, -64.0f, 64.0f));
        pos += 6;
View Full Code Here

        // Material
        prim.PrimData.Material = Material.get(block.Data[i++]);
        // Click action
        prim.ClickAction = ClickAction.get(block.Data[i++]);
        // Scale
        prim.Scale = new Vector3(block.Data, i);
        i += 12;
        // Position
        prim.Position = new Vector3(block.Data, i);
        i += 12;
        // Rotation
        prim.Rotation = new Quaternion(block.Data, i, true);
        i += 12;
        // Compressed flags
        //EnumSet<CompressedFlags>
        long flags = Utils.bytesToUIntLit(block.Data, i);
        i += 4;

        prim.OwnerID = new UUID(block.Data, i);
        i += 16;

        // Angular velocity
        if ((flags & CompressedFlags.HasAngularVelocity.getIndex()) != 0)
        {
          prim.AngularVelocity = new Vector3(block.Data, i);
          i += 12;
        }

        // Parent ID
        if ((flags & CompressedFlags.HasParent.getIndex()) != 0)
View Full Code Here

          {
            Primitive prim = e.getValue();
            if (prim.Joint.equals(JointType.Invalid))
            {
              //region Angular Velocity
              Vector3 angVel = prim.AngularVelocity;
              float omega = angVel.lengthSquared();

              if (omega > 0.00001f)
              {
                omega = (float)Math.sqrt(omega);
                float angle = omega * adjSeconds;
 
View Full Code Here

                    BurstSpeedMax = pack.UnpackFixed(false, 8, 8);
                    BurstPartCount = pack.UnpackByte();
                    float x = pack.UnpackFixed(true, 8, 7);
                    float y = pack.UnpackFixed(true, 8, 7);
                    float z = pack.UnpackFixed(true, 8, 7);
                    AngularVelocity = new Vector3(x, y, z);
                    x = pack.UnpackFixed(true, 8, 7);
                    y = pack.UnpackFixed(true, 8, 7);
                    z = pack.UnpackFixed(true, 8, 7);
                    PartAcceleration = new Vector3(x, y, z);
                    Texture = pack.UnpackUUID();
                    Target = pack.UnpackUUID();

                    PartDataFlags = ParticleDataFlags.get(pack.UnpackLBits(32));
                    PartMaxAge = pack.UnpackFixed(false, 8, 8);
View Full Code Here

      return relativePosition;
    }

    // a bit more complicatated, agent sitting on a prim
    Primitive p = null;
    Vector3 fullPosition = relativePosition;

    if ((( p = Client.network.getCurrentSim().ObjectsPrimitives.get(sittingOn)) != null))
    {
      fullPosition = Vector3.add(p.Position,  Vector3.multiply(relativePosition,  p.Rotation));
    }
View Full Code Here

      long[] xy = new long[2];
      Utils.longToUInts(Client.network.getCurrentSim().Handle.longValue(), xy);
      globalX = xy[0];
      globalY = xy[1];
      //                      Utils.LongToUInts(Client.network.getCurrentSim().Handle, out globalX, out globalY);
      Vector3 pos = getSimPosition();

      return new Vector3d(
          (double)globalX + (double)pos.X,
          (double)globalY + (double)pos.Y,
          (double)pos.Z);
View Full Code Here

  /// <param name="position">Position to teleport to</param>
  /// <returns>True if the lookup and teleport were successful, otherwise
  /// false</returns>
  public boolean Teleport(String simName, Vector3 position) throws InterruptedException
  {
    return Teleport(simName, position, new Vector3(0, 1.0f, 0));
  }
View Full Code Here

  /// <param name="position"><seealso cref="Vector3"/> position in destination sim to teleport to</param>
  /// <returns>true on success, false on failure</returns>
  /// <remarks>This call is blocking</remarks>
  public boolean Teleport(BigInteger regionHandle, Vector3 position) throws InterruptedException
  {
    return Teleport(regionHandle, position, new Vector3(0.0f, 1.0f, 0.0f));
  }
View Full Code Here

  /// </summary>
  /// <param name="regionHandle">handle of region to teleport agent to</param>
  /// <param name="position"><seealso cref="Vector3"/> position in destination sim to teleport to</param>
  public void RequestTeleport(BigInteger regionHandle, Vector3 position)
  {
    RequestTeleport(regionHandle, position, new Vector3(0.0f, 1.0f, 0.0f));
  }
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.types.Vector3

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.