Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
247c66b3fe | ||
|
|
73c2162ff6 | ||
|
|
889ce36afa | ||
|
|
c3d4b66953 | ||
|
|
234b29cf66 | ||
|
|
31827b0286 | ||
|
|
df121a7cd0 | ||
|
|
03df03b269 | ||
|
|
f1522e6204 | ||
|
|
87bce90086 | ||
|
|
4a29a7f92c | ||
|
|
0149265ee8 | ||
|
|
0844e5951c | ||
|
|
251d1b8fbb | ||
|
|
7f0f5060ec | ||
|
|
d179f2cce9 | ||
|
|
5d0778014d | ||
|
|
4c10826caa | ||
|
|
873c9098d8 | ||
|
|
6ce5080049 | ||
|
|
b9546d12f2 | ||
|
|
a49c524c9e | ||
|
|
b7f1fc116e | ||
|
|
28aa8010b2 | ||
|
|
c09eb00031 | ||
|
|
1113b3b6eb | ||
|
|
a81a16f22f | ||
|
|
8428b25939 |
@@ -123,6 +123,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod;
|
||||
availableMethods["admin_shutdown"] = XmlRpcShutdownMethod;
|
||||
availableMethods["admin_broadcast"] = XmlRpcAlertMethod;
|
||||
availableMethods["admin_dialog"] = XmlRpcDialogMethod;
|
||||
availableMethods["admin_restart"] = XmlRpcRestartMethod;
|
||||
availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
|
||||
// User management
|
||||
@@ -277,6 +278,53 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
m_log.Info("[RADMIN]: Alert request complete");
|
||||
return response;
|
||||
}
|
||||
public XmlRpcResponse XmlRpcDialogMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
m_log.Info("[RADMIN]: Dialog request started");
|
||||
|
||||
try
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
checkStringParameters(request, new string[] { "password", "from", "message" });
|
||||
|
||||
if (m_requiredPassword != String.Empty &&
|
||||
(!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword))
|
||||
throw new Exception("wrong password");
|
||||
|
||||
string message = (string)requestData["message"];
|
||||
string fromuuid = (string)requestData["from"];
|
||||
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
|
||||
|
||||
responseData["accepted"] = true;
|
||||
responseData["success"] = true;
|
||||
response.Value = responseData;
|
||||
|
||||
m_app.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
|
||||
|
||||
responseData["accepted"] = false;
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
response.Value = responseData;
|
||||
}
|
||||
|
||||
m_log.Info("[RADMIN]: Alert request complete");
|
||||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
|
||||
@@ -785,6 +785,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public virtual void SendLayerData(float[] map)
|
||||
{
|
||||
Util.FireAndForget(DoSendLayerData, map);
|
||||
|
||||
// Send it sync, and async. It's not that much data
|
||||
// and it improves user experience just so much!
|
||||
DoSendLayerData(map);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -797,16 +801,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
try
|
||||
{
|
||||
//for (int y = 0; y < 16; y++)
|
||||
//{
|
||||
// for (int x = 0; x < 16; x++)
|
||||
// {
|
||||
// SendLayerData(x, y, map);
|
||||
// }
|
||||
//}
|
||||
|
||||
// Send LayerData in a spiral pattern. Fun!
|
||||
SendLayerTopRight(map, 0, 0, 15, 15);
|
||||
for (int y = 0; y < 16; y++)
|
||||
{
|
||||
for (int x = 0; x < 16; x+=4)
|
||||
{
|
||||
SendLayerPacket(x, y, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -814,51 +815,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// Row
|
||||
for (int i = x1; i <= x2; i++)
|
||||
SendLayerData(i, y1, map);
|
||||
|
||||
// Column
|
||||
for (int j = y1 + 1; j <= y2; j++)
|
||||
SendLayerData(x2, j, map);
|
||||
|
||||
if (x2 - x1 > 0)
|
||||
SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
|
||||
}
|
||||
|
||||
void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// Row in reverse
|
||||
for (int i = x2; i >= x1; i--)
|
||||
SendLayerData(i, y2, map);
|
||||
|
||||
// Column in reverse
|
||||
for (int j = y2 - 1; j >= y1; j--)
|
||||
SendLayerData(x1, j, map);
|
||||
|
||||
if (x2 - x1 > 0)
|
||||
SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a set of four patches (x, x+1, ..., x+3) to the client
|
||||
/// </summary>
|
||||
/// <param name="map">heightmap</param>
|
||||
/// <param name="px">X coordinate for patches 0..12</param>
|
||||
/// <param name="py">Y coordinate for patches 0..15</param>
|
||||
// private void SendLayerPacket(float[] map, int y, int x)
|
||||
// {
|
||||
// int[] patches = new int[4];
|
||||
// patches[0] = x + 0 + y * 16;
|
||||
// patches[1] = x + 1 + y * 16;
|
||||
// patches[2] = x + 2 + y * 16;
|
||||
// patches[3] = x + 3 + y * 16;
|
||||
private void SendLayerPacket(int x, int y, float[] map)
|
||||
{
|
||||
int[] patches = new int[4];
|
||||
patches[0] = x + 0 + y * 16;
|
||||
patches[1] = x + 1 + y * 16;
|
||||
patches[2] = x + 2 + y * 16;
|
||||
patches[3] = x + 3 + y * 16;
|
||||
|
||||
// Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
|
||||
// OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||
// }
|
||||
float[] heightmap = (map.Length == 65536) ?
|
||||
map :
|
||||
LLHeightFieldMoronize(map);
|
||||
|
||||
try
|
||||
{
|
||||
Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
|
||||
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||
}
|
||||
catch
|
||||
{
|
||||
for (int px = x ; px < x + 4 ; px++)
|
||||
SendLayerData(px, y, map);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a specified patch to a client
|
||||
@@ -3136,7 +3121,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data);
|
||||
|
||||
OutPacket(objupdate, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
@@ -3187,8 +3171,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue();
|
||||
}
|
||||
|
||||
// HACK: Using the task category until the tiered reprioritization code is in
|
||||
OutPacket(terse, ThrottleOutPacketType.Task);
|
||||
OutPacket(terse, ThrottleOutPacketType.State);
|
||||
}
|
||||
|
||||
public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
|
||||
|
||||
@@ -399,6 +399,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
#region Queue or Send
|
||||
|
||||
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category);
|
||||
outgoingPacket.Type = type;
|
||||
|
||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
|
||||
SendPacketFinal(outgoingPacket);
|
||||
@@ -510,6 +511,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
byte flags = buffer.Data[0];
|
||||
bool isResend = (flags & Helpers.MSG_RESENT) != 0;
|
||||
bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0;
|
||||
bool sendSynchronous = false;
|
||||
LLUDPClient udpClient = outgoingPacket.Client;
|
||||
|
||||
if (!udpClient.IsConnected)
|
||||
@@ -565,9 +567,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (isReliable)
|
||||
Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength);
|
||||
|
||||
// Put the UDP payload on the wire
|
||||
AsyncBeginSend(buffer);
|
||||
//Some packet types need to be sent synchonously.
|
||||
//Sorry, i know it's not optimal, but until the LL client
|
||||
//manages packets correctly and re-orders them as required, this is necessary.
|
||||
|
||||
|
||||
// Put the UDP payload on the wire
|
||||
if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate)
|
||||
{
|
||||
SyncBeginPrioritySend(buffer, 2); // highest priority
|
||||
}
|
||||
else if (outgoingPacket.Type == PacketType.ObjectUpdate
|
||||
|| outgoingPacket.Type == PacketType.LayerData)
|
||||
{
|
||||
SyncBeginPrioritySend(buffer, 1); // medium priority
|
||||
}
|
||||
else
|
||||
{
|
||||
SyncBeginPrioritySend(buffer, 0); // normal priority
|
||||
}
|
||||
|
||||
//AsyncBeginSend(buffer);
|
||||
|
||||
// Keep track of when this packet was sent out (right now)
|
||||
outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue;
|
||||
}
|
||||
@@ -842,7 +863,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length);
|
||||
|
||||
AsyncBeginSend(buffer);
|
||||
SyncBeginPrioritySend(buffer, 1); //Setting this to a medium priority should help minimise resends
|
||||
}
|
||||
|
||||
private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo)
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
|
||||
namespace OpenMetaverse
|
||||
@@ -52,12 +53,30 @@ namespace OpenMetaverse
|
||||
/// <summary>Local IP address to bind to in server mode</summary>
|
||||
protected IPAddress m_localBindAddress;
|
||||
|
||||
/// <summary>
|
||||
/// Standard queue for our outgoing SyncBeginPrioritySend
|
||||
/// </summary>
|
||||
private List<UDPPacketBuffer> m_standardQueue = new List<UDPPacketBuffer>();
|
||||
|
||||
/// <summary>
|
||||
/// Medium priority queue for our outgoing SyncBeginPrioritySend
|
||||
/// </summary>
|
||||
private List<UDPPacketBuffer> m_mediumPriorityQueue = new List<UDPPacketBuffer>();
|
||||
|
||||
/// <summary>
|
||||
/// Prioritised queue for our outgoing SyncBeginPrioritySend
|
||||
/// </summary>
|
||||
private List<UDPPacketBuffer> m_priorityQueue = new List<UDPPacketBuffer>();
|
||||
|
||||
/// <summary>UDP socket, used in either client or server mode</summary>
|
||||
private Socket m_udpSocket;
|
||||
|
||||
/// <summary>Flag to process packets asynchronously or synchronously</summary>
|
||||
private bool m_asyncPacketHandling;
|
||||
|
||||
/// <summary>Are we currently sending data asynchronously?</summary>
|
||||
private volatile bool m_sendingData = false;
|
||||
|
||||
/// <summary>The all important shutdown flag</summary>
|
||||
private volatile bool m_shutdownFlag = true;
|
||||
|
||||
@@ -246,7 +265,51 @@ namespace OpenMetaverse
|
||||
}
|
||||
}
|
||||
|
||||
public void AsyncBeginSend(UDPPacketBuffer buf)
|
||||
public void SyncBeginPrioritySend(UDPPacketBuffer buf, int Priority)
|
||||
{
|
||||
if (!m_shutdownFlag)
|
||||
{
|
||||
if (!m_sendingData)
|
||||
{
|
||||
m_sendingData = true;
|
||||
try
|
||||
{
|
||||
AsyncBeginSend(buf);
|
||||
}
|
||||
catch (SocketException) { }
|
||||
catch (ObjectDisposedException) { }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Priority == 2)
|
||||
{
|
||||
lock (m_priorityQueue)
|
||||
{
|
||||
m_priorityQueue.Add(buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Priority != 0)
|
||||
{
|
||||
lock (m_mediumPriorityQueue)
|
||||
{
|
||||
m_mediumPriorityQueue.Add(buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (m_standardQueue)
|
||||
{
|
||||
m_standardQueue.Add(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AsyncBeginSend(UDPPacketBuffer buf)
|
||||
{
|
||||
if (!m_shutdownFlag)
|
||||
{
|
||||
@@ -270,8 +333,48 @@ namespace OpenMetaverse
|
||||
{
|
||||
try
|
||||
{
|
||||
// UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState;
|
||||
m_udpSocket.EndSendTo(result);
|
||||
|
||||
if (m_sendingData)
|
||||
{
|
||||
lock (m_priorityQueue)
|
||||
{
|
||||
if (m_priorityQueue.Count > 0)
|
||||
{
|
||||
UDPPacketBuffer buf = m_priorityQueue[0];
|
||||
m_priorityQueue.RemoveAt(0);
|
||||
AsyncBeginSend(buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (m_mediumPriorityQueue)
|
||||
{
|
||||
if (m_mediumPriorityQueue.Count > 0)
|
||||
{
|
||||
UDPPacketBuffer buf = m_mediumPriorityQueue[0];
|
||||
m_mediumPriorityQueue.RemoveAt(0);
|
||||
AsyncBeginSend(buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (m_standardQueue)
|
||||
{
|
||||
if (m_standardQueue.Count > 0)
|
||||
{
|
||||
UDPPacketBuffer buf = m_standardQueue[0];
|
||||
m_standardQueue.RemoveAt(0);
|
||||
AsyncBeginSend(buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sendingData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SocketException) { }
|
||||
catch (ObjectDisposedException) { }
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
using System;
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
@@ -52,7 +53,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public int TickCount;
|
||||
/// <summary>Category this packet belongs to</summary>
|
||||
public ThrottleOutPacketType Category;
|
||||
|
||||
/// <summary>The type of packet so its delivery method can be determined</summary>
|
||||
public PacketType Type;
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
|
||||
@@ -266,25 +266,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
|
||||
|
||||
((Scene)c.Scene).ForEachScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
// ignore chat from child agents
|
||||
if (presence.IsChildAgent) return;
|
||||
|
||||
IClientAPI client = presence.ControllingClient;
|
||||
|
||||
// don't forward SayOwner chat from objects to
|
||||
// non-owner agents
|
||||
if ((c.Type == ChatTypeEnum.Owner) &&
|
||||
(null != c.SenderObject) &&
|
||||
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
|
||||
return;
|
||||
|
||||
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
|
||||
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
|
||||
});
|
||||
if (c.Scene != null)
|
||||
{
|
||||
((Scene)c.Scene).ForEachScenePresence
|
||||
(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
// ignore chat from child agents
|
||||
if (presence.IsChildAgent) return;
|
||||
|
||||
IClientAPI client = presence.ControllingClient;
|
||||
|
||||
// don't forward SayOwner chat from objects to
|
||||
// non-owner agents
|
||||
if ((c.Type == ChatTypeEnum.Owner) &&
|
||||
(null != c.SenderObject) &&
|
||||
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
|
||||
return;
|
||||
|
||||
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
|
||||
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -164,19 +164,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
|
||||
"POST", m_RestURL+"/RetrieveMessages/", client.AgentId);
|
||||
|
||||
foreach (GridInstantMessage im in msglist)
|
||||
if (msglist != null)
|
||||
{
|
||||
// client.SendInstantMessage(im);
|
||||
foreach (GridInstantMessage im in msglist)
|
||||
{
|
||||
// client.SendInstantMessage(im);
|
||||
|
||||
// Send through scene event manager so all modules get a chance
|
||||
// to look at this message before it gets delivered.
|
||||
//
|
||||
// Needed for proper state management for stored group
|
||||
// invitations
|
||||
//
|
||||
Scene s = FindScene(client.AgentId);
|
||||
if (s != null)
|
||||
s.EventManager.TriggerIncomingInstantMessage(im);
|
||||
// Send through scene event manager so all modules get a chance
|
||||
// to look at this message before it gets delivered.
|
||||
//
|
||||
// Needed for proper state management for stored group
|
||||
// invitations
|
||||
//
|
||||
Scene s = FindScene(client.AgentId);
|
||||
if (s != null)
|
||||
s.EventManager.TriggerIncomingInstantMessage(im);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
Vector3 left = Vector3.Transform(Vector3.UnitY, rotMatrix);
|
||||
|
||||
// Check control flags
|
||||
bool heldForward = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
|
||||
bool heldBack = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG;
|
||||
bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS);
|
||||
bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG);
|
||||
bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS;
|
||||
bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG;
|
||||
//bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT;
|
||||
|
||||
@@ -840,8 +840,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
SceneObjectGroup group = part.ParentGroup;
|
||||
if (group != null)
|
||||
SceneObjectGroup group = null;
|
||||
if (part != null)
|
||||
{
|
||||
group = part.ParentGroup;
|
||||
}
|
||||
if (part != null && group != null)
|
||||
{
|
||||
TaskInventoryItem item = group.GetInventoryItem(localID, itemID);
|
||||
if (item == null)
|
||||
|
||||
@@ -1164,16 +1164,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Check if any objects have reached their targets
|
||||
CheckAtTargets();
|
||||
|
||||
// Update SceneObjectGroups that have scheduled themselves for updates
|
||||
// Objects queue their updates onto all scene presences
|
||||
if (m_frame % m_update_objects == 0)
|
||||
m_sceneGraph.UpdateObjectGroups();
|
||||
|
||||
// Run through all ScenePresences looking for updates
|
||||
// Presence updates and queued object updates for each presence are sent to clients
|
||||
if (m_frame % m_update_presences == 0)
|
||||
m_sceneGraph.UpdatePresences();
|
||||
|
||||
// Update SceneObjectGroups that have scheduled themselves for updates
|
||||
// Objects queue their updates onto all scene presences
|
||||
if (m_frame % m_update_objects == 0)
|
||||
m_sceneGraph.UpdateObjectGroups();
|
||||
|
||||
int TempPhysicsMS2 = Environment.TickCount;
|
||||
if ((m_frame % m_update_physics == 0) && m_physics_enabled)
|
||||
m_sceneGraph.UpdatePreparePhysics();
|
||||
|
||||
@@ -1734,6 +1734,45 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
public void rotLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
SceneObjectPart rootpart = m_rootPart;
|
||||
if (rootpart != null)
|
||||
{
|
||||
if (IsAttachment)
|
||||
{
|
||||
/*
|
||||
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
|
||||
if (avatar != null)
|
||||
{
|
||||
Rotate the Av?
|
||||
} */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rootpart.PhysActor != null)
|
||||
{
|
||||
rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W);
|
||||
rootpart.PhysActor.APIDStrength = strength;
|
||||
rootpart.PhysActor.APIDDamping = damping;
|
||||
rootpart.PhysActor.APIDActive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void stopLookAt()
|
||||
{
|
||||
SceneObjectPart rootpart = m_rootPart;
|
||||
if (rootpart != null)
|
||||
{
|
||||
if (rootpart.PhysActor != null)
|
||||
{
|
||||
rootpart.PhysActor.APIDActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds.
|
||||
/// </summary>
|
||||
|
||||
@@ -1064,14 +1064,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear all pending updates of parts to clients
|
||||
/// </summary>
|
||||
private void ClearUpdateSchedule()
|
||||
{
|
||||
m_updateFlag = 0;
|
||||
}
|
||||
|
||||
private void SendObjectPropertiesToClient(UUID AgentID)
|
||||
{
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
@@ -2185,6 +2177,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
}
|
||||
|
||||
public void RotLookAt(Quaternion target, float strength, float damping)
|
||||
{
|
||||
m_parentGroup.rotLookAt(target, strength, damping);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Schedules this prim for a full update
|
||||
@@ -2389,8 +2386,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
const float ROTATION_TOLERANCE = 0.01f;
|
||||
const float VELOCITY_TOLERANCE = 0.001f;
|
||||
const float POSITION_TOLERANCE = 0.05f;
|
||||
const int TIME_MS_TOLERANCE = 3000;
|
||||
const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
|
||||
const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
|
||||
|
||||
if (m_updateFlag == 1)
|
||||
{
|
||||
@@ -2404,7 +2401,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
|
||||
{
|
||||
AddTerseUpdateToAllAvatars();
|
||||
ClearUpdateSchedule();
|
||||
|
||||
|
||||
// This causes the Scene to 'poll' physical objects every couple of frames
|
||||
// bad, so it's been replaced by an event driven method.
|
||||
@@ -2422,16 +2419,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_lastAngularVelocity = AngularVelocity;
|
||||
m_lastTerseSent = Environment.TickCount;
|
||||
}
|
||||
//Moved this outside of the if clause so updates don't get blocked.. *sigh*
|
||||
m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
|
||||
{
|
||||
AddFullUpdateToAllAvatars();
|
||||
ClearUpdateSchedule();
|
||||
m_updateFlag = 0; //Same here
|
||||
}
|
||||
}
|
||||
ClearUpdateSchedule();
|
||||
m_updateFlag = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2684,6 +2683,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SetText(text);
|
||||
}
|
||||
|
||||
public void StopLookAt()
|
||||
{
|
||||
m_parentGroup.stopLookAt();
|
||||
|
||||
m_parentGroup.ScheduleGroupForTerseUpdate();
|
||||
}
|
||||
|
||||
public void StopMoveToTarget()
|
||||
{
|
||||
m_parentGroup.stopMoveToTarget();
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// {
|
||||
// m_log.Debug("[ScenePresence] Destructor called");
|
||||
// }
|
||||
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
|
||||
@@ -89,7 +89,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis
|
||||
/// issue #1716
|
||||
/// </summary>
|
||||
private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f);
|
||||
// private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f);
|
||||
private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f);
|
||||
|
||||
public UUID currentParcelUUID = UUID.Zero;
|
||||
|
||||
@@ -113,7 +114,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public Vector3 lastKnownAllowedPosition;
|
||||
public bool sentMessageAboutRestrictedParcelFlyingDown;
|
||||
public Vector4 CollisionPlane = Vector4.UnitW;
|
||||
|
||||
|
||||
private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation
|
||||
private Vector3 m_lastPosition;
|
||||
private Quaternion m_lastRotation;
|
||||
private Vector3 m_lastVelocity;
|
||||
@@ -144,7 +146,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private int m_perfMonMS;
|
||||
|
||||
private bool m_setAlwaysRun;
|
||||
|
||||
private bool m_forceFly;
|
||||
private bool m_flyDisabled;
|
||||
|
||||
@@ -168,7 +169,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected RegionInfo m_regionInfo;
|
||||
protected ulong crossingFromRegion;
|
||||
|
||||
private readonly Vector3[] Dir_Vectors = new Vector3[6];
|
||||
private readonly Vector3[] Dir_Vectors = new Vector3[9];
|
||||
private bool m_isNudging = false;
|
||||
|
||||
// Position of agent's camera in world (region cordinates)
|
||||
protected Vector3 m_CameraCenter;
|
||||
@@ -232,6 +234,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG,
|
||||
DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS,
|
||||
DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG,
|
||||
DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS,
|
||||
DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG,
|
||||
DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG
|
||||
}
|
||||
|
||||
@@ -716,21 +720,41 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
Dir_Vectors[3] = -Vector3.UnitY; //RIGHT
|
||||
Dir_Vectors[4] = Vector3.UnitZ; //UP
|
||||
Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
|
||||
Dir_Vectors[5] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
|
||||
Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
|
||||
Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
|
||||
Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
|
||||
}
|
||||
|
||||
private Vector3[] GetWalkDirectionVectors()
|
||||
{
|
||||
Vector3[] vector = new Vector3[6];
|
||||
Vector3[] vector = new Vector3[9];
|
||||
vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD
|
||||
vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK
|
||||
vector[2] = Vector3.UnitY; //LEFT
|
||||
vector[3] = -Vector3.UnitY; //RIGHT
|
||||
vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP
|
||||
vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
|
||||
vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge
|
||||
vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE
|
||||
vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
|
||||
vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge
|
||||
return vector;
|
||||
}
|
||||
|
||||
private bool[] GetDirectionIsNudge()
|
||||
{
|
||||
bool[] isNudge = new bool[9];
|
||||
isNudge[0] = false; //FORWARD
|
||||
isNudge[1] = false; //BACK
|
||||
isNudge[2] = false; //LEFT
|
||||
isNudge[3] = false; //RIGHT
|
||||
isNudge[4] = false; //UP
|
||||
isNudge[5] = false; //DOWN
|
||||
isNudge[6] = true; //FORWARD_NUDGE
|
||||
isNudge[7] = true; //BACK_NUDGE
|
||||
isNudge[8] = true; //DOWN_Nudge
|
||||
return isNudge;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1147,7 +1171,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
|
||||
// return;
|
||||
//}
|
||||
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
|
||||
++m_movementUpdateCount;
|
||||
@@ -1229,7 +1252,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback);
|
||||
}
|
||||
}
|
||||
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
if (scriptedcontrols.Count > 0)
|
||||
@@ -1261,7 +1283,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_allowMovement)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -1289,6 +1310,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
update_rotation = true;
|
||||
}
|
||||
|
||||
//guilty until proven innocent..
|
||||
bool Nudging = true;
|
||||
//Basically, if there is at least one non-nudge control then we don't need
|
||||
//to worry about stopping the avatar
|
||||
|
||||
if (m_parentID == 0)
|
||||
{
|
||||
bool bAllowUpdateMoveToPosition = false;
|
||||
@@ -1303,6 +1329,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
else
|
||||
dirVectors = Dir_Vectors;
|
||||
|
||||
bool[] isNudge = GetDirectionIsNudge();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
|
||||
{
|
||||
if (((uint)flags & (uint)DCF) != 0)
|
||||
@@ -1312,6 +1344,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
try
|
||||
{
|
||||
agent_control_v3 += dirVectors[i];
|
||||
if (isNudge[i] == false)
|
||||
{
|
||||
Nudging = false;
|
||||
}
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
@@ -1373,6 +1409,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Ignore z component of vector
|
||||
Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
|
||||
LocalVectorToTarget2D.Normalize();
|
||||
|
||||
//We're not nudging
|
||||
Nudging = false;
|
||||
agent_control_v3 += LocalVectorToTarget2D;
|
||||
|
||||
// update avatar movement flags. the avatar coordinate system is as follows:
|
||||
@@ -1455,7 +1494,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// m_log.DebugFormat(
|
||||
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
|
||||
|
||||
AddNewMovement(agent_control_v3, q);
|
||||
AddNewMovement(agent_control_v3, q, Nudging);
|
||||
|
||||
if (update_movementflag)
|
||||
Animator.UpdateMovementAnimations();
|
||||
@@ -1538,7 +1577,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
Velocity = Vector3.Zero;
|
||||
SendFullUpdateToAllClients();
|
||||
|
||||
//HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
|
||||
HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); //KF ??
|
||||
}
|
||||
//ControllingClient.SendSitResponse(m_requestedSitTargetID, m_requestedSitOffset, Quaternion.Identity, false, Vector3.Zero, Vector3.Zero, false);
|
||||
m_requestedSitTargetUUID = UUID.Zero;
|
||||
@@ -1651,7 +1690,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
bool SitTargetisSet =
|
||||
(!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 1f &&
|
||||
avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f));
|
||||
|
||||
// this test is probably failing
|
||||
if (SitTargetisSet && SitTargetUnOccupied)
|
||||
{
|
||||
//switch the target to this prim
|
||||
@@ -1678,26 +1717,37 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
// TODO: determine position to sit at based on scene geometry; don't trust offset from client
|
||||
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
|
||||
|
||||
|
||||
// part is the prim to sit on
|
||||
// offset is the vector distance from that prim center to the click-spot
|
||||
// UUID is the UUID of the Avatar doing the clicking
|
||||
|
||||
m_avInitialPos = AbsolutePosition; // saved to calculate unscripted sit rotation
|
||||
|
||||
// Is a sit target available?
|
||||
Vector3 avSitOffSet = part.SitTargetPosition;
|
||||
Quaternion avSitOrientation = part.SitTargetOrientation;
|
||||
UUID avOnTargetAlready = part.GetAvatarOnSitTarget();
|
||||
|
||||
bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero));
|
||||
bool SitTargetisSet =
|
||||
(!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 0f &&
|
||||
avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f));
|
||||
// bool SitTargetisSet =
|
||||
// (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 0f &&
|
||||
// avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f));
|
||||
|
||||
bool SitTargetisSet = ((Vector3.Zero != avSitOffSet) || (Quaternion.Identity != avSitOrientation));
|
||||
|
||||
//Console.WriteLine("SendSitResponse offset=" + offset + " UnOccup=" + SitTargetUnOccupied +
|
||||
// " TargSet=" + SitTargetisSet);
|
||||
|
||||
if (SitTargetisSet && SitTargetUnOccupied)
|
||||
{
|
||||
part.SetAvatarOnSitTarget(UUID);
|
||||
offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z);
|
||||
sitOrientation = avSitOrientation;
|
||||
autopilot = false;
|
||||
autopilot = false; // Jump direct to scripted llSitPos()
|
||||
}
|
||||
|
||||
pos = part.AbsolutePosition + offset;
|
||||
pos = part.AbsolutePosition + offset; // Region position where clicked
|
||||
//if (Math.Abs(part.AbsolutePosition.Z - AbsolutePosition.Z) > 1)
|
||||
//{
|
||||
// offset = pos;
|
||||
@@ -1710,17 +1760,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_sitAvatarHeight = m_physicsActor.Size.Z;
|
||||
|
||||
if (autopilot)
|
||||
{
|
||||
{ // its not a scripted sit
|
||||
if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5)
|
||||
{
|
||||
autopilot = false;
|
||||
autopilot = false; // close enough
|
||||
|
||||
RemoveFromPhysicalScene();
|
||||
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
|
||||
}
|
||||
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, (m_sitAvatarHeight / 2.0f)); // Warp av to Prim
|
||||
} // else the autopilot will get us close
|
||||
}
|
||||
else
|
||||
{
|
||||
{ // its a scripted sit
|
||||
RemoveFromPhysicalScene();
|
||||
}
|
||||
}
|
||||
@@ -1823,26 +1873,41 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (part.GetAvatarOnSitTarget() == UUID)
|
||||
{
|
||||
// Scripted sit
|
||||
Vector3 sitTargetPos = part.SitTargetPosition;
|
||||
Quaternion sitTargetOrient = part.SitTargetOrientation;
|
||||
|
||||
//Quaternion vq = new Quaternion(sitTargetPos.X, sitTargetPos.Y+0.2f, sitTargetPos.Z+0.2f, 0);
|
||||
//Quaternion nq = new Quaternion(-sitTargetOrient.X, -sitTargetOrient.Y, -sitTargetOrient.Z, sitTargetOrient.w);
|
||||
|
||||
//Quaternion result = (sitTargetOrient * vq) * nq;
|
||||
|
||||
m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z);
|
||||
m_pos += SIT_TARGET_ADJUSTMENT;
|
||||
m_bodyRot = sitTargetOrient;
|
||||
//Rotation = sitTargetOrient;
|
||||
m_parentPosition = part.AbsolutePosition;
|
||||
|
||||
//SendTerseUpdateToAllClients();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pos -= part.AbsolutePosition;
|
||||
// Non-scripted sit by Kitto Flora 21Nov09
|
||||
// Calculate angle of line from prim to Av
|
||||
float y_diff = (m_avInitialPos.Y - part.AbsolutePosition.Y);
|
||||
float x_diff = ( m_avInitialPos.X - part.AbsolutePosition.X);
|
||||
if(Math.Abs(x_diff) < 0.001f) x_diff = 0.001f; // avoid div by 0
|
||||
if(Math.Abs(y_diff) < 0.001f) y_diff = 0.001f; // avoid pol flip at 0
|
||||
float sit_angle = (float)Math.Atan2( (double)y_diff, (double)x_diff);
|
||||
Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
|
||||
// NOTE: when sitting m_ pos and m_bodyRot are *relative* to the prim location/rotation, not 'World'.
|
||||
// Av sits at world euler <0,0, z>, translated by part rotation
|
||||
m_bodyRot = partIRot * Quaternion.CreateFromEulers(0f, 0f, sit_angle); // sit at 0,0,inv-click
|
||||
m_pos = new Vector3(0f, 0f, 0.05f) +
|
||||
(new Vector3(0.0f, 0f, 0.625f) * partIRot) +
|
||||
(new Vector3(0.25f, 0f, 0.0f) * m_bodyRot); // sit at center of prim
|
||||
m_parentPosition = part.AbsolutePosition;
|
||||
//Set up raytrace to find top surface of prim
|
||||
Vector3 size = part.Scale;
|
||||
float mag = 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z));
|
||||
Vector3 start = part.AbsolutePosition + new Vector3(0f, 0f, mag);
|
||||
Vector3 down = new Vector3(0f, 0f, -1f);
|
||||
m_scene.PhysicsScene.RaycastWorld(
|
||||
start, // Vector3 position,
|
||||
down, // Vector3 direction,
|
||||
mag, // float length,
|
||||
SitAltitudeCallback); // retMethod
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1857,11 +1922,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
Animator.TrySetMovementAnimation(sitAnimation);
|
||||
SendFullUpdateToAllClients();
|
||||
// This may seem stupid, but Our Full updates don't send avatar rotation :P
|
||||
// So we're also sending a terse update (which has avatar rotation)
|
||||
// [Update] We do now.
|
||||
//SendTerseUpdateToAllClients();
|
||||
}
|
||||
|
||||
public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance)
|
||||
{
|
||||
// Console.WriteLine("[RAYCASTRESULT]: Hit={0}, Point={1}, ID={2}, Dist={3}", hitYN, collisionPoint, localid, distance);
|
||||
if(hitYN)
|
||||
{
|
||||
// m_pos = Av offset from prim center to make look like on center
|
||||
// m_parentPosition = Actual center pos of prim
|
||||
// collisionPoint = spot on prim where we want to sit
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(localid);
|
||||
Vector3 offset = (collisionPoint - m_parentPosition) * Quaternion.Inverse(part.RotationOffset);
|
||||
m_pos += offset;
|
||||
// Console.WriteLine("m_pos={0}, offset={1} newsit={2}", m_pos, offset, newsit);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for the 'Always run' setting on the client
|
||||
@@ -1891,7 +1967,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
|
||||
/// <param name="rotation">The direction in which this avatar should now face.
|
||||
public void AddNewMovement(Vector3 vec, Quaternion rotation)
|
||||
public void AddNewMovement(Vector3 vec, Quaternion rotation, bool Nudging)
|
||||
{
|
||||
if (m_isChildAgent)
|
||||
{
|
||||
@@ -1965,7 +2041,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// TODO: Add the force instead of only setting it to support multiple forces per frame?
|
||||
m_forceToApply = direc;
|
||||
|
||||
m_isNudging = Nudging;
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
}
|
||||
|
||||
@@ -1980,7 +2056,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
const float POSITION_TOLERANCE = 0.05f;
|
||||
//const int TIME_MS_TOLERANCE = 3000;
|
||||
|
||||
SendPrimUpdates();
|
||||
|
||||
|
||||
if (m_newCoarseLocations)
|
||||
{
|
||||
@@ -2016,6 +2092,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
CheckForBorderCrossing();
|
||||
CheckForSignificantMovement(); // sends update to the modules.
|
||||
}
|
||||
|
||||
//Sending prim updates AFTER the avatar terse updates are sent
|
||||
SendPrimUpdates();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -2869,14 +2948,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (m_forceToApply.HasValue)
|
||||
{
|
||||
Vector3 force = m_forceToApply.Value;
|
||||
|
||||
Vector3 force = m_forceToApply.Value;
|
||||
m_updateflag = true;
|
||||
// movementvector = force;
|
||||
Velocity = force;
|
||||
|
||||
m_forceToApply = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_isNudging)
|
||||
{
|
||||
Vector3 force = Vector3.Zero;
|
||||
|
||||
m_updateflag = true;
|
||||
Velocity = force;
|
||||
m_isNudging = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetText(string text, Vector3 color, double alpha)
|
||||
@@ -3585,4 +3674,4 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,6 +303,26 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -619,6 +619,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override Quaternion APIDTarget { set { return; } }
|
||||
public override bool APIDActive { set { return; } }
|
||||
public override float APIDStrength { set { return; } }
|
||||
public override float APIDDamping { set { return; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds the force supplied to the Target Velocity
|
||||
|
||||
@@ -565,6 +565,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
||||
public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } }
|
||||
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
|
||||
|
||||
public override Quaternion APIDTarget { set { return; } }
|
||||
public override bool APIDActive { set { return; } }
|
||||
public override float APIDStrength { set { return; } }
|
||||
public override float APIDDamping { set { return; } }
|
||||
|
||||
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
|
||||
@@ -1238,6 +1238,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||
public override PIDHoverType PIDHoverType { set { return; } }
|
||||
public override float PIDHoverTau { set { return; } }
|
||||
|
||||
public override OpenMetaverse.Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
|
||||
@@ -243,7 +243,12 @@ namespace OpenSim.Region.Physics.Manager
|
||||
public abstract PIDHoverType PIDHoverType { set;}
|
||||
public abstract float PIDHoverTau { set;}
|
||||
|
||||
|
||||
// For RotLookAt
|
||||
public abstract Quaternion APIDTarget { set;}
|
||||
public abstract bool APIDActive { set;}
|
||||
public abstract float APIDStrength { set;}
|
||||
public abstract float APIDDamping { set;}
|
||||
|
||||
public abstract void AddForce(Vector3 force, bool pushforce);
|
||||
public abstract void AddAngularForce(Vector3 force, bool pushforce);
|
||||
public abstract void SetMomentum(Vector3 momentum);
|
||||
@@ -476,6 +481,12 @@ namespace OpenSim.Region.Physics.Manager
|
||||
public override bool PIDHoverActive { set { return; } }
|
||||
public override PIDHoverType PIDHoverType { set { return; } }
|
||||
public override float PIDHoverTau { set { return; } }
|
||||
|
||||
public override Quaternion APIDTarget { set { return; } }
|
||||
public override bool APIDActive { set { return; } }
|
||||
public override float APIDStrength { set { return; } }
|
||||
public override float APIDDamping { set { return; } }
|
||||
|
||||
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
|
||||
@@ -1196,6 +1196,28 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
public override bool PIDHoverActive { set { return; } }
|
||||
public override PIDHoverType PIDHoverType { set { return; } }
|
||||
public override float PIDHoverTau { set { return; } }
|
||||
|
||||
public override Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,19 @@
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces
|
||||
* ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
|
||||
* ODEPrim.cs contains methods dealing with Prim editing, Prim
|
||||
* characteristics and Kinetic motion.
|
||||
* ODEDynamics.cs contains methods dealing with Prim Physical motion
|
||||
* (dynamics) and the associated settings. Old Linear and angular
|
||||
* motors for dynamic motion have been replace with MoveLinear()
|
||||
* and MoveAngular(); 'Physical' is used only to switch ODE dynamic
|
||||
* simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to
|
||||
* switch between 'VEHICLE' parameter use and general dynamics
|
||||
* settings use.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Revised Aug, Sept 2009 by Kitto Flora. ODEDynamics.cs replaces
|
||||
@@ -120,7 +133,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
// private float m_VhoverEfficiency = 0f;
|
||||
private float m_VhoverTimescale = 0f;
|
||||
private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height
|
||||
private float m_VehicleBuoyancy = 0f; //KF: m_VehicleBuoyancy is set by VEHICLE_BUOYANCY for a vehicle.
|
||||
private float m_VehicleBuoyancy = 0f; // Set by VEHICLE_BUOYANCY, for a vehicle.
|
||||
// Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity)
|
||||
// KF: So far I have found no good method to combine a script-requested .Z velocity and gravity.
|
||||
// Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity.
|
||||
@@ -479,7 +492,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object
|
||||
m_dir *= rotq; // apply obj rotation to velocity vector
|
||||
|
||||
// add Gravity andBuoyancy
|
||||
// add Gravity and Buoyancy
|
||||
// KF: So far I have found no good method to combine a script-requested
|
||||
// .Z velocity and gravity. Therefore only 0g will used script-requested
|
||||
// .Z velocity. >0g (m_VehicleBuoyancy < 1) will used modified gravity only.
|
||||
@@ -561,6 +574,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate
|
||||
private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body
|
||||
*/
|
||||
//if(frcount == 0) Console.WriteLine("MoveAngular ");
|
||||
|
||||
// Get what the body is doing, this includes 'external' influences
|
||||
d.Vector3 angularVelocity = d.BodyGetAngularVel(Body);
|
||||
@@ -636,7 +650,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
// Deflection section tba
|
||||
|
||||
// Sum velocities
|
||||
m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection
|
||||
m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // tba: + bank + deflection
|
||||
|
||||
if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
|
||||
{
|
||||
|
||||
@@ -21,6 +21,18 @@
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Revised August 26 2009 by Kitto Flora. ODEDynamics.cs replaces
|
||||
* ODEVehicleSettings.cs. It and ODEPrim.cs are re-organised:
|
||||
* ODEPrim.cs contains methods dealing with Prim editing, Prim
|
||||
* characteristics and Kinetic motion.
|
||||
* ODEDynamics.cs contains methods dealing with Prim Physical motion
|
||||
* (dynamics) and the associated settings. Old Linear and angular
|
||||
* motors for dynamic motion have been replace with MoveLinear()
|
||||
* and MoveAngular(); 'Physical' is used only to switch ODE dynamic
|
||||
* simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to
|
||||
* switch between 'VEHICLE' parameter use and general dynamics
|
||||
* settings use.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -81,7 +93,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
private float m_PIDTau;
|
||||
private float PID_D = 35f;
|
||||
private float PID_G = 25f;
|
||||
private bool m_usePID;
|
||||
private bool m_usePID = false;
|
||||
|
||||
private Quaternion m_APIDTarget = new Quaternion();
|
||||
private float m_APIDStrength = 0.5f;
|
||||
private float m_APIDDamping = 0.5f;
|
||||
private bool m_useAPID = false;
|
||||
|
||||
// KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
|
||||
// and are for non-VEHICLES only.
|
||||
@@ -182,6 +199,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
private ODEDynamics m_vehicle;
|
||||
|
||||
internal int m_material = (int)Material.Wood;
|
||||
|
||||
private int frcount = 0; // Used to limit dynamics debug output to
|
||||
|
||||
|
||||
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
|
||||
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
|
||||
@@ -1558,9 +1578,14 @@ Console.WriteLine(" JointCreateFixed");
|
||||
float fy = 0;
|
||||
float fz = 0;
|
||||
|
||||
frcount++; // used to limit debug comment output
|
||||
if (frcount > 100)
|
||||
frcount = 0;
|
||||
|
||||
if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims.
|
||||
{
|
||||
//if(frcount == 0) Console.WriteLine("Move " + m_primName + " VTyp " + m_vehicle.Type +
|
||||
// " usePID=" + m_usePID + " seHover=" + m_useHoverPID + " useAPID=" + m_useAPID);
|
||||
if (m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||
{
|
||||
// 'VEHICLES' are dealt with in ODEDynamics.cs
|
||||
@@ -1568,7 +1593,6 @@ Console.WriteLine(" JointCreateFixed");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("Move " + m_primName);
|
||||
if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
|
||||
// NON-'VEHICLES' are dealt with here
|
||||
if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
|
||||
@@ -1590,21 +1614,18 @@ Console.WriteLine(" JointCreateFixed");
|
||||
//m_log.Info(m_collisionFlags.ToString());
|
||||
|
||||
|
||||
//KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
|
||||
// would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ??
|
||||
//KF: m_buoyancy is set by llSetBuoyancy() and is for non-vehicle.
|
||||
// m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up
|
||||
// gravityz multiplier = 1 - m_buoyancy
|
||||
fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass;
|
||||
// NB Prims in ODE are no subject to global gravity
|
||||
fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; // force = acceleration * mass
|
||||
|
||||
if (m_usePID)
|
||||
{
|
||||
//Console.WriteLine("PID " + m_primName);
|
||||
// KF - this is for object move? eg. llSetPos() ?
|
||||
//if(frcount == 0) Console.WriteLine("PID " + m_primName);
|
||||
// KF - this is for object MoveToTarget.
|
||||
|
||||
//if (!d.BodyIsEnabled(Body))
|
||||
//d.BodySetForce(Body, 0f, 0f, 0f);
|
||||
// If we're using the PID controller, then we have no gravity
|
||||
//fz = (-1 * _parent_scene.gravityz) * m_mass; //KF: ?? Prims have no global gravity,so simply...
|
||||
fz = 0f;
|
||||
|
||||
// no lock; for now it's only called from within Simulate()
|
||||
|
||||
@@ -1739,7 +1760,7 @@ Console.WriteLine(" JointCreateFixed");
|
||||
d.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight);
|
||||
d.BodySetLinearVel(Body, vel.X, vel.Y, 0);
|
||||
d.BodyAddForce(Body, 0, 0, fz);
|
||||
return;
|
||||
//KF this prevents furthur motions return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1748,8 +1769,46 @@ Console.WriteLine(" JointCreateFixed");
|
||||
// We're flying and colliding with something
|
||||
fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass);
|
||||
}
|
||||
}
|
||||
|
||||
} // end m_useHoverPID && !m_usePID
|
||||
|
||||
if (m_useAPID)
|
||||
{
|
||||
// RotLookAt, apparently overrides all other rotation sources. Inputs:
|
||||
// Quaternion m_APIDTarget
|
||||
// float m_APIDStrength // From SL experiments, this is the time to get there
|
||||
// float m_APIDDamping // From SL experiments, this is damping, 1.0 = damped, 0.1 = wobbly
|
||||
// Also in SL the mass of the object has no effect on time to get there.
|
||||
// Factors:
|
||||
//if(frcount == 0) Console.WriteLine("APID ");
|
||||
// get present body rotation
|
||||
float limit = 1.0f;
|
||||
float scaler = 50f; // adjusts damping time
|
||||
float RLAservo = 0f;
|
||||
|
||||
d.Quaternion rot = d.BodyGetQuaternion(Body);
|
||||
Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W);
|
||||
Quaternion rot_diff = Quaternion.Inverse(rotq) * m_APIDTarget;
|
||||
float diff_angle;
|
||||
Vector3 diff_axis;
|
||||
rot_diff.GetAxisAngle(out diff_axis, out diff_angle);
|
||||
diff_axis.Normalize();
|
||||
if(diff_angle > 0.01f) // diff_angle is always +ve
|
||||
{
|
||||
// PhysicsVector rotforce = new PhysicsVector(diff_axis.X, diff_axis.Y, diff_axis.Z);
|
||||
Vector3 rotforce = new Vector3(diff_axis.X, diff_axis.Y, diff_axis.Z);
|
||||
rotforce = rotforce * rotq;
|
||||
if(diff_angle > limit) diff_angle = limit; // cap the rotate rate
|
||||
// RLAservo = timestep / m_APIDStrength * m_mass * scaler;
|
||||
// rotforce = rotforce * RLAservo * diff_angle ;
|
||||
// d.BodyAddRelTorque(Body, rotforce.X, rotforce.Y, rotforce.Z);
|
||||
RLAservo = timestep / m_APIDStrength * scaler;
|
||||
rotforce = rotforce * RLAservo * diff_angle ;
|
||||
d.BodySetAngularVel (Body, rotforce.X, rotforce.Y, rotforce.Z);
|
||||
//Console.WriteLine("axis= " + diff_axis + " angle= " + diff_angle + "servo= " + RLAservo);
|
||||
}
|
||||
//if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + " angle= " + diff_angle);
|
||||
} // end m_useAPID
|
||||
|
||||
fx *= m_mass;
|
||||
fy *= m_mass;
|
||||
//fz *= m_mass;
|
||||
@@ -2816,6 +2875,12 @@ Console.WriteLine(" JointCreateFixed");
|
||||
}
|
||||
public override bool PIDActive { set { m_usePID = value; } }
|
||||
public override float PIDTau { set { m_PIDTau = value; } }
|
||||
|
||||
// For RotLookAt
|
||||
public override Quaternion APIDTarget { set { m_APIDTarget = value; } }
|
||||
public override bool APIDActive { set { m_useAPID = value; } }
|
||||
public override float APIDStrength { set { m_APIDStrength = value; } }
|
||||
public override float APIDDamping { set { m_APIDDamping = value; } }
|
||||
|
||||
public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } }
|
||||
public override bool PIDHoverActive { set { m_useHoverPID = value; } }
|
||||
|
||||
@@ -304,6 +304,27 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
|
||||
@@ -299,6 +299,26 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
public override Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
|
||||
@@ -498,6 +498,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||
public override bool PIDHoverActive { set { return; } }
|
||||
public override PIDHoverType PIDHoverType { set { return; } }
|
||||
public override float PIDHoverTau { set { return; } }
|
||||
|
||||
public override Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
@@ -780,6 +802,28 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||
public override bool PIDHoverActive { set { return; } }
|
||||
public override PIDHoverType PIDHoverType { set { return; } }
|
||||
public override float PIDHoverTau { set { return; } }
|
||||
|
||||
public override Quaternion APIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override bool APIDActive
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDStrength
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override float APIDDamping
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void SubscribeEvents(int ms)
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics; //for [DebuggerNonUserCode]
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -151,6 +152,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
get { return m_ScriptEngine.World; }
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
public void state(string newState)
|
||||
{
|
||||
m_ScriptEngine.SetState(m_itemID, newState);
|
||||
@@ -160,6 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// Reset the named script. The script must be present
|
||||
/// in the same prim.
|
||||
/// </summary>
|
||||
[DebuggerNonUserCode]
|
||||
public void llResetScript()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -2699,11 +2702,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// Orient the object to the angle calculated
|
||||
llSetRot(rot);
|
||||
}
|
||||
|
||||
public void llRotLookAt(LSL_Rotation target, double strength, double damping)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
// NotImplemented("llRotLookAt");
|
||||
m_host.RotLookAt(Rot2Quaternion(target), (float)strength, (float)damping);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void llStopLookAt()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llStopLookAt");
|
||||
// NotImplemented("llStopLookAt");
|
||||
m_host.StopLookAt();
|
||||
}
|
||||
|
||||
public void llSetTimerEvent(double sec)
|
||||
@@ -3047,12 +3060,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_host.AddScriptLPS(1);
|
||||
}
|
||||
|
||||
public void llRotLookAt(LSL_Rotation target, double strength, double damping)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llRotLookAt");
|
||||
}
|
||||
|
||||
public LSL_Integer llStringLength(string str)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -3751,6 +3758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
ScriptSleep(3000);
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
public void llRemoveInventory(string name)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics; //for [DebuggerNonUserCode]
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
@@ -131,6 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return (eventFlags);
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
public void ExecuteEvent(string state, string FunctionName, object[] args)
|
||||
{
|
||||
// IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
|
||||
|
||||
@@ -33,6 +33,7 @@ using System.Threading;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics; //for [DebuggerNonUserCode]
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
|
||||
@@ -90,6 +91,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return (int)m_Executor.GetStateEventFlags(state);
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
public void ExecuteEvent(string state, string FunctionName, object[] args)
|
||||
{
|
||||
m_Executor.ExecuteEvent(state, FunctionName, args);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics; //for [DebuggerNonUserCode]
|
||||
using System.Runtime.Remoting;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using System.Threading;
|
||||
@@ -544,6 +545,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
return true;
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode] //Prevents the debugger from farting in this function
|
||||
public void SetState(string state)
|
||||
{
|
||||
if (state == State)
|
||||
@@ -555,7 +557,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
new DetectParams[0]));
|
||||
PostEvent(new EventParams("state_entry", new Object[0],
|
||||
new DetectParams[0]));
|
||||
|
||||
|
||||
throw new EventAbortException();
|
||||
}
|
||||
|
||||
@@ -637,140 +639,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public object EventProcessor()
|
||||
{
|
||||
|
||||
EventParams data = null;
|
||||
|
||||
lock (m_EventQueue)
|
||||
{
|
||||
lock (m_Script)
|
||||
{
|
||||
EventParams data = null;
|
||||
|
||||
lock (m_EventQueue)
|
||||
{
|
||||
data = (EventParams) m_EventQueue.Dequeue();
|
||||
if (data == null) // Shouldn't happen
|
||||
{
|
||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
||||
{
|
||||
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentResult = null;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data.EventName == "timer")
|
||||
m_TimerQueued = false;
|
||||
if (data.EventName == "control")
|
||||
{
|
||||
if (m_ControlEventsInQueue > 0)
|
||||
m_ControlEventsInQueue--;
|
||||
}
|
||||
if (data.EventName == "collision")
|
||||
m_CollisionInQueue = false;
|
||||
}
|
||||
|
||||
//m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
|
||||
|
||||
m_DetectParams = data.DetectParams;
|
||||
|
||||
if (data.EventName == "state") // Hardcoded state change
|
||||
{
|
||||
// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
|
||||
// m_PrimName, m_ScriptName, data.Params[0].ToString());
|
||||
m_State=data.Params[0].ToString();
|
||||
AsyncCommandManager.RemoveScript(m_Engine,
|
||||
m_LocalID, m_ItemID);
|
||||
|
||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
||||
m_LocalID);
|
||||
if (part != null)
|
||||
{
|
||||
part.SetScriptEvents(m_ItemID,
|
||||
(int)m_Script.GetStateEventFlags(State));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
|
||||
data.EventName == "control") // Don't freeze avies!
|
||||
{
|
||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
||||
m_LocalID);
|
||||
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
|
||||
// m_PrimName, m_ScriptName, data.EventName, m_State);
|
||||
|
||||
try
|
||||
{
|
||||
m_CurrentEvent = data.EventName;
|
||||
m_EventStart = DateTime.Now;
|
||||
m_InEvent = true;
|
||||
|
||||
m_Script.ExecuteEvent(State, data.EventName, data.Params);
|
||||
|
||||
m_InEvent = false;
|
||||
m_CurrentEvent = String.Empty;
|
||||
|
||||
if (m_SaveState)
|
||||
{
|
||||
// This will be the very first event we deliver
|
||||
// (state_entry) in default state
|
||||
//
|
||||
|
||||
SaveState(m_Assembly);
|
||||
|
||||
m_SaveState = false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
|
||||
m_InEvent = false;
|
||||
m_CurrentEvent = String.Empty;
|
||||
|
||||
if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException))
|
||||
{
|
||||
try
|
||||
{
|
||||
// DISPLAY ERROR INWORLD
|
||||
string text = FormatException(e);
|
||||
|
||||
if (text.Length > 1000)
|
||||
text = text.Substring(0, 1000);
|
||||
m_Engine.World.SimChat(Utils.StringToBytes(text),
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
part.AbsolutePosition,
|
||||
part.Name, part.UUID, false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
// catch (Exception e2) // LEGIT: User Scripting
|
||||
// {
|
||||
// m_log.Error("[SCRIPT]: "+
|
||||
// "Error displaying error in-world: " +
|
||||
// e2.ToString());
|
||||
// m_log.Error("[SCRIPT]: " +
|
||||
// "Errormessage: Error compiling script:\r\n" +
|
||||
// e.ToString());
|
||||
// }
|
||||
}
|
||||
else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
|
||||
{
|
||||
m_InSelfDelete = true;
|
||||
if (part != null && part.ParentGroup != null)
|
||||
m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
|
||||
}
|
||||
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
|
||||
{
|
||||
m_InSelfDelete = true;
|
||||
if (part != null && part.ParentGroup != null)
|
||||
part.Inventory.RemoveInventoryItem(m_ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lock (m_EventQueue)
|
||||
data = (EventParams) m_EventQueue.Dequeue();
|
||||
if (data == null) // Shouldn't happen
|
||||
{
|
||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
||||
{
|
||||
@@ -780,13 +658,141 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
{
|
||||
m_CurrentResult = null;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_DetectParams = null;
|
||||
|
||||
return 0;
|
||||
if (data.EventName == "timer")
|
||||
m_TimerQueued = false;
|
||||
if (data.EventName == "control")
|
||||
{
|
||||
if (m_ControlEventsInQueue > 0)
|
||||
m_ControlEventsInQueue--;
|
||||
}
|
||||
if (data.EventName == "collision")
|
||||
m_CollisionInQueue = false;
|
||||
}
|
||||
}
|
||||
lock(m_Script)
|
||||
{
|
||||
|
||||
//m_log.DebugFormat("[XENGINE]: Processing event {0} for {1}", data.EventName, this);
|
||||
|
||||
m_DetectParams = data.DetectParams;
|
||||
|
||||
if (data.EventName == "state") // Hardcoded state change
|
||||
{
|
||||
// m_log.DebugFormat("[Script] Script {0}.{1} state set to {2}",
|
||||
// m_PrimName, m_ScriptName, data.Params[0].ToString());
|
||||
m_State=data.Params[0].ToString();
|
||||
AsyncCommandManager.RemoveScript(m_Engine,
|
||||
m_LocalID, m_ItemID);
|
||||
|
||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
||||
m_LocalID);
|
||||
if (part != null)
|
||||
{
|
||||
part.SetScriptEvents(m_ItemID,
|
||||
(int)m_Script.GetStateEventFlags(State));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
|
||||
data.EventName == "control") // Don't freeze avies!
|
||||
{
|
||||
SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
|
||||
m_LocalID);
|
||||
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
|
||||
// m_PrimName, m_ScriptName, data.EventName, m_State);
|
||||
|
||||
try
|
||||
{
|
||||
m_CurrentEvent = data.EventName;
|
||||
m_EventStart = DateTime.Now;
|
||||
m_InEvent = true;
|
||||
|
||||
m_Script.ExecuteEvent(State, data.EventName, data.Params);
|
||||
|
||||
m_InEvent = false;
|
||||
m_CurrentEvent = String.Empty;
|
||||
|
||||
if (m_SaveState)
|
||||
{
|
||||
// This will be the very first event we deliver
|
||||
// (state_entry) in default state
|
||||
//
|
||||
|
||||
SaveState(m_Assembly);
|
||||
|
||||
m_SaveState = false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
|
||||
m_InEvent = false;
|
||||
m_CurrentEvent = String.Empty;
|
||||
|
||||
if ((!(e is TargetInvocationException) || (!(e.InnerException is SelfDeleteException) && !(e.InnerException is ScriptDeleteException))) && !(e is ThreadAbortException))
|
||||
{
|
||||
try
|
||||
{
|
||||
// DISPLAY ERROR INWORLD
|
||||
string text = FormatException(e);
|
||||
|
||||
if (text.Length > 1000)
|
||||
text = text.Substring(0, 1000);
|
||||
m_Engine.World.SimChat(Utils.StringToBytes(text),
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
part.AbsolutePosition,
|
||||
part.Name, part.UUID, false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
// catch (Exception e2) // LEGIT: User Scripting
|
||||
// {
|
||||
// m_log.Error("[SCRIPT]: "+
|
||||
// "Error displaying error in-world: " +
|
||||
// e2.ToString());
|
||||
// m_log.Error("[SCRIPT]: " +
|
||||
// "Errormessage: Error compiling script:\r\n" +
|
||||
// e.ToString());
|
||||
// }
|
||||
}
|
||||
else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
|
||||
{
|
||||
m_InSelfDelete = true;
|
||||
if (part != null && part.ParentGroup != null)
|
||||
m_Engine.World.DeleteSceneObject(part.ParentGroup, false);
|
||||
}
|
||||
else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
|
||||
{
|
||||
m_InSelfDelete = true;
|
||||
if (part != null && part.ParentGroup != null)
|
||||
part.Inventory.RemoveInventoryItem(m_ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lock (m_EventQueue)
|
||||
{
|
||||
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
|
||||
{
|
||||
m_CurrentResult = m_Engine.QueueEventHandler(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentResult = null;
|
||||
}
|
||||
}
|
||||
|
||||
m_DetectParams = null;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int EventTime()
|
||||
{
|
||||
@@ -824,6 +830,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
new Object[0], new DetectParams[0]));
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode] //Stops the VS debugger from farting in this function
|
||||
public void ApiResetScript()
|
||||
{
|
||||
// bool running = Running;
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics; //for [DebuggerNonUserCode]
|
||||
using System.Security;
|
||||
using System.Security.Policy;
|
||||
using System.Reflection;
|
||||
@@ -1119,6 +1120,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
return false;
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
public void ApiResetScript(UUID itemID)
|
||||
{
|
||||
IScriptInstance instance = GetInstance(itemID);
|
||||
@@ -1170,6 +1172,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode]
|
||||
public void SetState(UUID itemID, string newState)
|
||||
{
|
||||
IScriptInstance instance = GetInstance(itemID);
|
||||
|
||||
Reference in New Issue
Block a user