void ObjectExtraParamsHandler(Packet packet, Agent agent) { ObjectExtraParamsPacket extra = (ObjectExtraParamsPacket)packet; for (int i = 0; i < extra.ObjectData.Length; i++) { ObjectExtraParamsPacket.ObjectDataBlock block = extra.ObjectData[i]; SimulationObject obj; if (server.Scene.TryGetObject(block.ObjectLocalID, out obj)) { ExtraParamType type = (ExtraParamType)block.ParamType; } } }
/// <summary> /// Unset additional primitive parameters on an object /// </summary> /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param> /// <param name="localID">The objects ID which is local to the simulator the object is in</param> /// <param name="type">The extra parameters to set</param> public void SetExtraParamOff(Simulator simulator, uint localID, ExtraParamType type) { ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket(); extra.AgentData.AgentID = Client.Self.AgentID; extra.AgentData.SessionID = Client.Self.SessionID; extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1]; extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock(); extra.ObjectData[0].ObjectLocalID = localID; extra.ObjectData[0].ParamType = (byte)type; extra.ObjectData[0].ParamInUse = false; extra.ObjectData[0].ParamData = Utils.EmptyBytes; extra.ObjectData[0].ParamSize = 0; Client.Network.SendPacket(extra, simulator); }
/// <summary> /// Set the sculptie texture and data on an object /// </summary> /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param> /// <param name="localID">The objects ID which is local to the simulator the object is in</param> /// <param name="sculpt">A <seealso cref="Primitive.SculptData"/> object containing the data to set</param> public void SetSculpt(Simulator simulator, uint localID, Primitive.SculptData sculpt) { ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket(); extra.AgentData.AgentID = Client.Self.AgentID; extra.AgentData.SessionID = Client.Self.SessionID; extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1]; extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock(); extra.ObjectData[0].ObjectLocalID = localID; extra.ObjectData[0].ParamType = (byte)ExtraParamType.Sculpt; extra.ObjectData[0].ParamInUse = true; extra.ObjectData[0].ParamData = sculpt.GetBytes(); extra.ObjectData[0].ParamSize = (uint)extra.ObjectData[0].ParamData.Length; Client.Network.SendPacket(extra, simulator); // Not sure why, but if you don't send this the sculpted prim disappears 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].PathScaleX = 100; shape.ObjectData[0].PathScaleY = 150; shape.ObjectData[0].PathCurve = 32; Client.Network.SendPacket(shape, simulator); }
/// <summary> /// Set the flexible data on an object /// </summary> /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param> /// <param name="localID">The objects ID which is local to the simulator the object is in</param> /// <param name="flexible">A <seealso cref="Primitive.FlexibleData"/> object containing the data to set</param> public void SetFlexible(Simulator simulator, uint localID, Primitive.FlexibleData flexible) { ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket(); extra.AgentData.AgentID = Client.Self.AgentID; extra.AgentData.SessionID = Client.Self.SessionID; extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1]; extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock(); extra.ObjectData[0].ObjectLocalID = localID; extra.ObjectData[0].ParamType = (byte)ExtraParamType.Flexible; extra.ObjectData[0].ParamInUse = true; extra.ObjectData[0].ParamData = flexible.GetBytes(); extra.ObjectData[0].ParamSize = (uint)extra.ObjectData[0].ParamData.Length; Client.Network.SendPacket(extra, simulator); }
/// <summary> /// Set the Light data on an object /// </summary> /// <param name="simulator">A reference to the <seealso cref="OpenMetaverse.Simulator"/> object where the object resides</param> /// <param name="localID">The objects ID which is local to the simulator the object is in</param> /// <param name="light">A <seealso cref="Primitive.LightData"/> object containing the data to set</param> public void SetLight(Simulator simulator, uint localID, Primitive.LightData light) { ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket(); extra.AgentData.AgentID = Client.Self.AgentID; extra.AgentData.SessionID = Client.Self.SessionID; extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1]; extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock(); extra.ObjectData[0].ObjectLocalID = localID; extra.ObjectData[0].ParamType = (byte)ExtraParamType.Light; if (light.Intensity == 0.0f) { // Disables the light if intensity is 0 extra.ObjectData[0].ParamInUse = false; } else { extra.ObjectData[0].ParamInUse = true; } extra.ObjectData[0].ParamData = light.GetBytes(); extra.ObjectData[0].ParamSize = (uint)extra.ObjectData[0].ParamData.Length; Client.Network.SendPacket(extra, simulator); }
/// <summary> /// /// </summary> /// <param name="simulator"></param> /// <param name="localID"></param> /// <param name="light"></param> public void SetLight(Simulator simulator, uint localID, PrimLightData light) { ObjectExtraParamsPacket extra = new ObjectExtraParamsPacket(); extra.AgentData.AgentID = Client.Network.AgentID; extra.AgentData.SessionID = Client.Network.SessionID; extra.ObjectData = new ObjectExtraParamsPacket.ObjectDataBlock[1]; extra.ObjectData[0] = new ObjectExtraParamsPacket.ObjectDataBlock(); extra.ObjectData[0].ObjectLocalID = localID; extra.ObjectData[0].ParamType = (byte)ExtraParamType.Light; if (light == null) { extra.ObjectData[0].ParamInUse = false; extra.ObjectData[0].ParamData = new byte[0]; } else { extra.ObjectData[0].ParamInUse = true; extra.ObjectData[0].ParamData = light.GetBytes(); } extra.ObjectData[0].ParamSize = (uint)extra.ObjectData[0].ParamData.Length; Client.Network.SendPacket(extra, simulator); }