OpenMetaverse.ObjectManager.SetShape C# (CSharp) Method

SetShape() public method

Set the Shape data of an object
public SetShape ( Simulator simulator, uint localID, Primitive prim ) : void
simulator Simulator A reference to the object where the object resides
localID uint The objects ID which is local to the simulator the object is in
prim Primitive Data describing the prim shape
return void
        public void SetShape(Simulator simulator, uint localID, Primitive.ConstructionData prim)
        {
            ObjectShapePacket shape = new ObjectShapePacket();

            shape.AgentData.AgentID = Client.Self.AgentID;
            shape.AgentData.SessionID = Client.Self.SessionID;

            shape.ObjectData = new OpenMetaverse.Packets.ObjectShapePacket.ObjectDataBlock[1];
            shape.ObjectData[0] = new OpenMetaverse.Packets.ObjectShapePacket.ObjectDataBlock();

            shape.ObjectData[0].ObjectLocalID = localID;

            shape.ObjectData[0].PathCurve = (byte)prim.PathCurve;
            shape.ObjectData[0].PathBegin = Primitive.PackBeginCut(prim.PathBegin);
            shape.ObjectData[0].PathEnd = Primitive.PackEndCut(prim.PathEnd);
            shape.ObjectData[0].PathScaleX = Primitive.PackPathScale(prim.PathScaleX);
            shape.ObjectData[0].PathScaleY = Primitive.PackPathScale(prim.PathScaleY);
            shape.ObjectData[0].PathShearX = (byte)Primitive.PackPathShear(prim.PathShearX);
            shape.ObjectData[0].PathShearY = (byte)Primitive.PackPathShear(prim.PathShearY);
            shape.ObjectData[0].PathTwist = Primitive.PackPathTwist(prim.PathTwist);
            shape.ObjectData[0].PathTwistBegin = Primitive.PackPathTwist(prim.PathTwistBegin);
            shape.ObjectData[0].PathRadiusOffset = Primitive.PackPathTwist(prim.PathRadiusOffset);
            shape.ObjectData[0].PathTaperX = Primitive.PackPathTaper(prim.PathTaperX);
            shape.ObjectData[0].PathTaperY = Primitive.PackPathTaper(prim.PathTaperY);
            shape.ObjectData[0].PathRevolutions = Primitive.PackPathRevolutions(prim.PathRevolutions);
            shape.ObjectData[0].PathSkew = Primitive.PackPathTwist(prim.PathSkew);

            shape.ObjectData[0].ProfileCurve = prim.profileCurve;
            shape.ObjectData[0].ProfileBegin = Primitive.PackBeginCut(prim.ProfileBegin);
            shape.ObjectData[0].ProfileEnd = Primitive.PackEndCut(prim.ProfileEnd);
            shape.ObjectData[0].ProfileHollow = Primitive.PackProfileHollow(prim.ProfileHollow);

            Client.Network.SendPacket(shape, simulator);
        }