diff --git a/libsecondlife-cs/ObjectManager.cs b/libsecondlife-cs/ObjectManager.cs
index 3b9bfcce..73bd64c7 100644
--- a/libsecondlife-cs/ObjectManager.cs
+++ b/libsecondlife-cs/ObjectManager.cs
@@ -416,7 +416,7 @@ namespace libsecondlife
packet.AgentData.GroupID = prim.GroupID;
packet.ObjectData.State = (byte)prim.State;
- packet.ObjectData.AddFlags = 2; // TODO: Why 2?
+ packet.ObjectData.AddFlags = ObjectFlags.CreateSelected;
packet.ObjectData.PCode = (byte)PCode.Prim;
packet.ObjectData.Material = (byte)prim.Material;
@@ -435,8 +435,8 @@ namespace libsecondlife
packet.ObjectData.PathSkew = PrimObject.PathSkewByte(prim.PathSkew);
packet.ObjectData.PathTaperX = PrimObject.PathTaperByte(prim.PathTaperX);
packet.ObjectData.PathTaperY = PrimObject.PathTaperByte(prim.PathTaperY);
- packet.ObjectData.PathTwist = PrimObject.PathTwistByte(prim.PathTwist);
- packet.ObjectData.PathTwistBegin = PrimObject.PathTwistByte(prim.PathTwistBegin);
+ packet.ObjectData.PathTwist = (sbyte)prim.PathTwist;
+ packet.ObjectData.PathTwistBegin = (sbyte)prim.PathTwistBegin;
packet.ObjectData.ProfileCurve = (byte)prim.ProfileCurve;
packet.ObjectData.ProfileBegin = PrimObject.ProfileBeginByte(prim.ProfileBegin);
diff --git a/libsecondlife-cs/Prims.cs b/libsecondlife-cs/Prims.cs
index 844c3408..76d552bb 100644
--- a/libsecondlife-cs/Prims.cs
+++ b/libsecondlife-cs/Prims.cs
@@ -158,18 +158,6 @@ namespace libsecondlife
return (float)Math.Round((double)pathScale * 0.01d - 1.0d, 6);
}
- ///
- ///
- ///
- ///
- ///
- public static sbyte PathTwistByte(float pathTwist)
- {
- // Y = 256 + ceil (X / 1.8)
- int twist = (int)(256.0d + Math.Ceiling((double)pathTwist / 1.8d));
- return (sbyte)(twist % 256);
- }
-
///
///
///
diff --git a/libsecondlife-cs/Region.cs b/libsecondlife-cs/Region.cs
index 720e97d1..91f129d1 100644
--- a/libsecondlife-cs/Region.cs
+++ b/libsecondlife-cs/Region.cs
@@ -233,61 +233,6 @@ namespace libsecondlife
//Client.Network.SendPacket((Packet)join, this.Simulator);
}
- ///
- ///
- ///
- ///
- ///
- ///
- public void RezObject(PrimObject prim, LLVector3 position, LLVector3 rayStart,
- LLUUID groupID)
- {
- ObjectAddPacket add = new ObjectAddPacket();
- add.AgentData.AgentID = Client.Network.AgentID;
- add.AgentData.SessionID = Client.Network.SessionID;
- add.AgentData.GroupID = groupID;
- // TODO: Why 2?
- add.ObjectData.AddFlags = 2;
- add.ObjectData.BypassRaycast = 1;
- add.ObjectData.Material = (byte)prim.Material;
- add.ObjectData.PathBegin = PrimObject.PathBeginByte(prim.PathBegin);
- add.ObjectData.PathCurve = (byte)prim.PathCurve;
- add.ObjectData.PathEnd = PrimObject.PathEndByte(prim.PathEnd);
- add.ObjectData.PathRadiusOffset = PrimObject.PathRadiusOffsetByte(prim.PathRadiusOffset);
- add.ObjectData.PathRevolutions = PrimObject.PathRevolutionsByte(prim.PathRevolutions);
- add.ObjectData.PathScaleX = PrimObject.PathScaleByte(prim.PathScaleX);
- add.ObjectData.PathScaleY = PrimObject.PathScaleByte(prim.PathScaleY);
- add.ObjectData.PathShearX = PrimObject.PathShearByte(prim.PathShearX);
- add.ObjectData.PathShearY = PrimObject.PathShearByte(prim.PathShearY);
- add.ObjectData.PathSkew = PrimObject.PathSkewByte(prim.PathSkew);
- add.ObjectData.PathTaperX = PrimObject.PathTaperByte(prim.PathTaperX);
- add.ObjectData.PathTaperY = PrimObject.PathTaperByte(prim.PathTaperY);
- add.ObjectData.PathTwist = PrimObject.PathTwistByte(prim.PathTwist);
- add.ObjectData.PathTwistBegin = PrimObject.PathTwistByte(prim.PathTwistBegin);
- add.ObjectData.PCode = (byte)prim.PCode;
- add.ObjectData.ProfileBegin = PrimObject.ProfileBeginByte(prim.ProfileBegin);
- add.ObjectData.ProfileCurve = (byte)prim.ProfileCurve;
- add.ObjectData.ProfileEnd = PrimObject.ProfileEndByte(prim.ProfileEnd);
- add.ObjectData.ProfileHollow = (byte)prim.ProfileHollow;
- add.ObjectData.RayEnd = position;
- add.ObjectData.RayEndIsIntersection = 0;
- add.ObjectData.RayStart = rayStart;
- add.ObjectData.RayTargetID = LLUUID.GenerateUUID();
- add.ObjectData.Rotation = prim.Rotation;
- add.ObjectData.Scale = prim.Scale;
- add.ObjectData.State = (byte)prim.State;
- if (prim.Textures != null)
- {
- add.ObjectData.TextureEntry = prim.Textures.ToBytes();
- }
- else
- {
- add.ObjectData.TextureEntry = new byte[0];
- }
-
- Client.Network.SendPacket(add);
- }
-
///
///
///
diff --git a/libsecondlife-cs/tests/PrimObjectTests.cs b/libsecondlife-cs/tests/PrimObjectTests.cs
new file mode 100644
index 00000000..3134090c
--- /dev/null
+++ b/libsecondlife-cs/tests/PrimObjectTests.cs
@@ -0,0 +1,143 @@
+using System;
+using System.Collections.Generic;
+using System.Net;
+using libsecondlife;
+using libsecondlife.Packets;
+using NUnit.Framework;
+
+namespace libsecondlife.Tests
+{
+ [TestFixture]
+ public class PrimObjectTests : Assert
+ {
+ [Test]
+ public void PathBegin()
+ {
+ for (byte i = 0; i < byte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.PathBeginFloat(i);
+ byte result = PrimObject.PathBeginByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void PathEnd()
+ {
+ for (byte i = 0; i < byte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.PathEndFloat(i);
+ byte result = PrimObject.PathEndByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void PathRadiusOffset()
+ {
+ for (sbyte i = sbyte.MinValue; i < sbyte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.PathRadiusOffsetFloat(i);
+ sbyte result = PrimObject.PathRadiusOffsetByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void PathRevolutions()
+ {
+ for (byte i = 0; i < byte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.PathRevolutionsFloat(i);
+ byte result = PrimObject.PathRevolutionsByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void PathScale()
+ {
+ for (byte i = 0; i < byte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.PathScaleFloat(i);
+ byte result = PrimObject.PathScaleByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void PathShear()
+ {
+ for (byte i = 0; i < byte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.PathShearFloat(i);
+ byte result = PrimObject.PathShearByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void PathSkew()
+ {
+ for (sbyte i = sbyte.MinValue; i < sbyte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.PathSkewFloat(i);
+ sbyte result = PrimObject.PathSkewByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void PathTaper()
+ {
+ for (sbyte i = sbyte.MinValue; i < sbyte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.PathTaperFloat(i);
+ sbyte result = PrimObject.PathTaperByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void ProfileBegin()
+ {
+ for (byte i = 0; i < byte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.ProfileBeginFloat(i);
+ byte result = PrimObject.ProfileBeginByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+
+ [Test]
+ public void ProfileEnd()
+ {
+ for (byte i = 0; i < byte.MaxValue; i++)
+ {
+ float floatValue = PrimObject.ProfileEndFloat(i);
+ byte result = PrimObject.ProfileEndByte(floatValue);
+
+ Assert.IsTrue(result == i, "Started with " + i + ", float value was " + floatValue +
+ ", and ended up with " + result);
+ }
+ }
+ }
+}
diff --git a/libsecondlife-cs/tests/libsecondlife.Tests.csproj b/libsecondlife-cs/tests/libsecondlife.Tests.csproj
index 9bba71cb..922ebb22 100644
--- a/libsecondlife-cs/tests/libsecondlife.Tests.csproj
+++ b/libsecondlife-cs/tests/libsecondlife.Tests.csproj
@@ -37,6 +37,7 @@
+