aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/ClientView.API.cs
diff options
context:
space:
mode:
authorMW2007-06-15 13:11:26 +0000
committerMW2007-06-15 13:11:26 +0000
commit95676b298819d6b2d1df74d1f52668e2549a2c2f (patch)
treee3152f0685f262253e72a482a4a3e4b64aae631a /OpenSim/OpenSim.RegionServer/ClientView.API.cs
parentand some more (diff)
downloadopensim-SC_OLD-95676b298819d6b2d1df74d1f52668e2549a2c2f.zip
opensim-SC_OLD-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.gz
opensim-SC_OLD-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.bz2
opensim-SC_OLD-95676b298819d6b2d1df74d1f52668e2549a2c2f.tar.xz
Preliminary movement added to sugilite, forwards walking only and no animations.
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/ClientView.API.cs')
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs99
1 files changed, 98 insertions, 1 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index 484ecc1..33727c4 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -47,7 +47,7 @@ namespace OpenSim
47 public event GenericCall OnRequestWearables; 47 public event GenericCall OnRequestWearables;
48 public event SetAppearance OnSetAppearance; 48 public event SetAppearance OnSetAppearance;
49 public event GenericCall2 OnCompleteMovementToRegion; 49 public event GenericCall2 OnCompleteMovementToRegion;
50 public event GenericCall3 OnAgentUpdate; 50 public event UpdateAgent OnAgentUpdate;
51 public event StartAnim OnStartAnim; 51 public event StartAnim OnStartAnim;
52 public event GenericCall OnRequestAvatarsData; 52 public event GenericCall OnRequestAvatarsData;
53 public event LinkObjects OnLinkObjects; 53 public event LinkObjects OnLinkObjects;
@@ -393,6 +393,26 @@ namespace OpenSim
393 393
394 } 394 }
395 395
396 /// <summary>
397 ///
398 /// </summary>
399 /// <param name="regionHandle"></param>
400 /// <param name="timeDilation"></param>
401 /// <param name="localID"></param>
402 /// <param name="position"></param>
403 /// <param name="velocity"></param>
404 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity)
405 {
406 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = this.CreateAvatarImprovedBlock(localID, position, velocity);
407 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
408 terse.RegionData.RegionHandle = regionHandle;
409 terse.RegionData.TimeDilation = timeDilation;
410 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
411 terse.ObjectData[0] = terseBlock;
412
413 this.OutPacket(terse);
414 }
415
396 #endregion 416 #endregion
397 417
398 #region Primitive Packet/data Sending Methods 418 #region Primitive Packet/data Sending Methods
@@ -491,6 +511,83 @@ namespace OpenSim
491 511
492 #region Helper Methods 512 #region Helper Methods
493 513
514 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateAvatarImprovedBlock(uint localID, LLVector3 pos, LLVector3 velocity)
515 {
516 byte[] bytes = new byte[60];
517 int i = 0;
518 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
519
520 dat.TextureEntry = new byte[0];// AvatarTemplate.TextureEntry;
521
522 uint ID = localID;
523
524 bytes[i++] = (byte)(ID % 256);
525 bytes[i++] = (byte)((ID >> 8) % 256);
526 bytes[i++] = (byte)((ID >> 16) % 256);
527 bytes[i++] = (byte)((ID >> 24) % 256);
528 bytes[i++] = 0;
529 bytes[i++] = 1;
530 i += 14;
531 bytes[i++] = 128;
532 bytes[i++] = 63;
533
534 byte[] pb = pos.GetBytes();
535 Array.Copy(pb, 0, bytes, i, pb.Length);
536 i += 12;
537 ushort InternVelocityX;
538 ushort InternVelocityY;
539 ushort InternVelocityZ;
540 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(0, 0, 0);
541
542 internDirec = new Axiom.MathLib.Vector3(velocity.X, velocity.Y, velocity.Z);
543
544 internDirec = internDirec / 128.0f;
545 internDirec.x += 1;
546 internDirec.y += 1;
547 internDirec.z += 1;
548
549 InternVelocityX = (ushort)(32768 * internDirec.x);
550 InternVelocityY = (ushort)(32768 * internDirec.y);
551 InternVelocityZ = (ushort)(32768 * internDirec.z);
552
553 ushort ac = 32767;
554 bytes[i++] = (byte)(InternVelocityX % 256);
555 bytes[i++] = (byte)((InternVelocityX >> 8) % 256);
556 bytes[i++] = (byte)(InternVelocityY % 256);
557 bytes[i++] = (byte)((InternVelocityY >> 8) % 256);
558 bytes[i++] = (byte)(InternVelocityZ % 256);
559 bytes[i++] = (byte)((InternVelocityZ >> 8) % 256);
560
561 //accel
562 bytes[i++] = (byte)(ac % 256);
563 bytes[i++] = (byte)((ac >> 8) % 256);
564 bytes[i++] = (byte)(ac % 256);
565 bytes[i++] = (byte)((ac >> 8) % 256);
566 bytes[i++] = (byte)(ac % 256);
567 bytes[i++] = (byte)((ac >> 8) % 256);
568
569 //rot
570 bytes[i++] = (byte)(ac % 256);
571 bytes[i++] = (byte)((ac >> 8) % 256);
572 bytes[i++] = (byte)(ac % 256);
573 bytes[i++] = (byte)((ac >> 8) % 256);
574 bytes[i++] = (byte)(ac % 256);
575 bytes[i++] = (byte)((ac >> 8) % 256);
576 bytes[i++] = (byte)(ac % 256);
577 bytes[i++] = (byte)((ac >> 8) % 256);
578
579 //rotation vel
580 bytes[i++] = (byte)(ac % 256);
581 bytes[i++] = (byte)((ac >> 8) % 256);
582 bytes[i++] = (byte)(ac % 256);
583 bytes[i++] = (byte)((ac >> 8) % 256);
584 bytes[i++] = (byte)(ac % 256);
585 bytes[i++] = (byte)((ac >> 8) % 256);
586
587 dat.Data = bytes;
588 return (dat);
589 }
590
494 /// <summary> 591 /// <summary>
495 /// 592 ///
496 /// </summary> 593 /// </summary>