/// <summary> /// Release a grabbed object /// </summary> /// <param name="objectLocalID">The Objects Simulator Local ID</param> /// <param name="uvCoord">The texture coordinates to grab</param> /// <param name="stCoord">The surface coordinates to grab</param> /// <param name="faceIndex">The face of the position to grab</param> /// <param name="position">The region coordinates of the position to grab</param> /// <param name="normal">The surface normal of the position to grab (A normal is a vector perpindicular to the surface)</param> /// <param name="binormal">The surface binormal of the position to grab (A binormal is a vector tangen to the surface /// pointing along the U direction of the tangent space</param> public void DeGrab(uint objectLocalID, Vector3 uvCoord, Vector3 stCoord, int faceIndex, Vector3 position, Vector3 normal, Vector3 binormal) { ObjectDeGrabPacket degrab = new ObjectDeGrabPacket(); degrab.AgentData.AgentID = Client.Self.AgentID; degrab.AgentData.SessionID = Client.Self.SessionID; degrab.ObjectData.LocalID = objectLocalID; degrab.SurfaceInfo = new ObjectDeGrabPacket.SurfaceInfoBlock[1]; degrab.SurfaceInfo[0] = new ObjectDeGrabPacket.SurfaceInfoBlock(); degrab.SurfaceInfo[0].UVCoord = uvCoord; degrab.SurfaceInfo[0].STCoord = stCoord; degrab.SurfaceInfo[0].FaceIndex = faceIndex; degrab.SurfaceInfo[0].Position = position; degrab.SurfaceInfo[0].Normal = normal; degrab.SurfaceInfo[0].Binormal = binormal; Client.Network.SendPacket(degrab); }
/// <summary> /// Releases a grabbed object /// </summary> /// <param name="objectLocalID">an unsigned integer of the objects ID within the simulator</param> /// <seealso cref="T:libsecondlife.NetworkManager.CurrentSim.ObjectsPrimitives"/> public void DeGrab(uint objectLocalID) { ObjectDeGrabPacket degrab = new ObjectDeGrabPacket(); degrab.AgentData.AgentID = Client.Self.AgentID; degrab.AgentData.SessionID = Client.Self.SessionID; degrab.ObjectData.LocalID = objectLocalID; Client.Network.SendPacket(degrab); }
/// <summary> /// Perform a click action (Grab) on a single object /// </summary> /// <param name="simulator">The <see cref="Simulator"/> the object is located</param> /// <param name="localID">The Local ID of the object</param> /// <param name="uvCoord">The texture coordinates to touch</param> /// <param name="stCoord">The surface coordinates to touch</param> /// <param name="faceIndex">The face of the position to touch</param> /// <param name="position">The region coordinates of the position to touch</param> /// <param name="normal">The surface normal of the position to touch (A normal is a vector perpindicular to the surface)</param> /// <param name="binormal">The surface binormal of the position to touch (A binormal is a vector tangen to the surface /// pointing along the U direction of the tangent space</param> public void ClickObject(Simulator simulator, uint localID, Vector3 uvCoord, Vector3 stCoord, int faceIndex, Vector3 position, Vector3 normal, Vector3 binormal) { ObjectGrabPacket grab = new ObjectGrabPacket(); grab.AgentData.AgentID = Client.Self.AgentID; grab.AgentData.SessionID = Client.Self.SessionID; grab.ObjectData.GrabOffset = Vector3.Zero; grab.ObjectData.LocalID = localID; grab.SurfaceInfo = new ObjectGrabPacket.SurfaceInfoBlock[1]; grab.SurfaceInfo[0] = new ObjectGrabPacket.SurfaceInfoBlock(); grab.SurfaceInfo[0].UVCoord = uvCoord; grab.SurfaceInfo[0].STCoord = stCoord; grab.SurfaceInfo[0].FaceIndex = faceIndex; grab.SurfaceInfo[0].Position = position; grab.SurfaceInfo[0].Normal = normal; grab.SurfaceInfo[0].Binormal = binormal; Client.Network.SendPacket(grab, simulator); // TODO: If these hit the server out of order the click will fail // and we'll be grabbing the object Thread.Sleep(50); ObjectDeGrabPacket degrab = new ObjectDeGrabPacket(); degrab.AgentData.AgentID = Client.Self.AgentID; degrab.AgentData.SessionID = Client.Self.SessionID; degrab.ObjectData.LocalID = localID; degrab.SurfaceInfo = new ObjectDeGrabPacket.SurfaceInfoBlock[1]; degrab.SurfaceInfo[0] = new ObjectDeGrabPacket.SurfaceInfoBlock(); degrab.SurfaceInfo[0].UVCoord = uvCoord; degrab.SurfaceInfo[0].STCoord = stCoord; degrab.SurfaceInfo[0].FaceIndex = faceIndex; degrab.SurfaceInfo[0].Position = position; degrab.SurfaceInfo[0].Normal = normal; degrab.SurfaceInfo[0].Binormal = binormal; Client.Network.SendPacket(degrab, simulator); }
/// <summary> /// Perform a click action 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> public void ClickObject(Simulator simulator, uint localID) { ObjectGrabPacket grab = new ObjectGrabPacket(); grab.AgentData.AgentID = Client.Self.AgentID; grab.AgentData.SessionID = Client.Self.SessionID; grab.ObjectData.GrabOffset = Vector3.Zero; grab.ObjectData.LocalID = localID; Client.Network.SendPacket(grab, simulator); // TODO: If these hit the server out of order the click will fail // and we'll be grabbing the object ObjectDeGrabPacket degrab = new ObjectDeGrabPacket(); degrab.AgentData.AgentID = Client.Self.AgentID; degrab.AgentData.SessionID = Client.Self.SessionID; degrab.ObjectData.LocalID = localID; Client.Network.SendPacket(degrab, simulator); }