mirror of
https://github.com/OpenSim-NGC/OpenSim-Sasquatch.git
synced 2024-11-21 14:29:10 -07:00
Merge remote-tracking branch 'upstream/master' into sasquatch-prebuild-maint
This commit is contained in:
commit
57adf94cf9
54 changed files with 2235 additions and 1717 deletions
|
@ -80,6 +80,8 @@ namespace OpenSim.Data
|
|||
{
|
||||
XInventoryFolder[] GetFolders(string[] fields, string[] vals);
|
||||
XInventoryItem[] GetItems(string[] fields, string[] vals);
|
||||
XInventoryItem[] GetItems(string idfield, string[] ids);
|
||||
XInventoryItem[] GetItems(string idfield, string id);
|
||||
|
||||
bool StoreFolder(XInventoryFolder folder);
|
||||
bool StoreItem(XInventoryItem item);
|
||||
|
@ -123,7 +125,7 @@ namespace OpenSim.Data
|
|||
/// <param name='id'>UUID of the item</param>
|
||||
/// <param name='newParent'>UUID of the new parent folder.</param>
|
||||
bool MoveItem(string id, string newParentFolderID);
|
||||
|
||||
bool MoveItems(string[] ids, string[] newParents);
|
||||
/// <summary>
|
||||
/// Move a folder to another folder.
|
||||
/// </summary>
|
||||
|
|
|
@ -1582,12 +1582,9 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum);
|
||||
cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl);
|
||||
|
||||
if (prim.AttachedPos != null)
|
||||
{
|
||||
cmd.Parameters.AddWithValue("AttachedPosX", prim.AttachedPos.X);
|
||||
cmd.Parameters.AddWithValue("AttachedPosY", prim.AttachedPos.Y);
|
||||
cmd.Parameters.AddWithValue("AttachedPosZ", prim.AttachedPos.Z);
|
||||
}
|
||||
cmd.Parameters.AddWithValue("AttachedPosX", prim.AttachedPos.X);
|
||||
cmd.Parameters.AddWithValue("AttachedPosY", prim.AttachedPos.Y);
|
||||
cmd.Parameters.AddWithValue("AttachedPosZ", prim.AttachedPos.Z);
|
||||
|
||||
if (prim.KeyframeMotion != null)
|
||||
cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize());
|
||||
|
|
|
@ -176,8 +176,6 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
if(string.IsNullOrEmpty(ad.ParcelName))
|
||||
ad.ParcelName = "Unknown";
|
||||
if(ad.ParcelId == null)
|
||||
ad.ParcelId = UUID.Zero;
|
||||
if(string.IsNullOrEmpty(ad.Description))
|
||||
ad.Description = "No Description";
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
@ -45,6 +45,7 @@ namespace OpenSim.Data.MySQL
|
|||
private MySqlFolderHandler m_Folders;
|
||||
private MySqlItemHandler m_Items;
|
||||
|
||||
|
||||
public MySQLXInventoryData(string conn, string realm)
|
||||
{
|
||||
m_Folders = new MySqlFolderHandler(
|
||||
|
@ -63,6 +64,16 @@ namespace OpenSim.Data.MySQL
|
|||
return m_Items.Get(fields, vals);
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetItems(string field, string[] vals)
|
||||
{
|
||||
return m_Items.Get(field, vals);
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetItems(string fields, string val)
|
||||
{
|
||||
return m_Items.Get(fields, val);
|
||||
}
|
||||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
if (folder.folderName.Length > 64)
|
||||
|
@ -106,6 +117,11 @@ namespace OpenSim.Data.MySQL
|
|||
return m_Items.MoveItem(id, newParent);
|
||||
}
|
||||
|
||||
public bool MoveItems(string[] ids, string[] newParents)
|
||||
{
|
||||
return m_Items.MoveItems(ids, newParents);
|
||||
}
|
||||
|
||||
public bool MoveFolder(string id, string newParent)
|
||||
{
|
||||
return m_Folders.MoveFolder(id, newParent);
|
||||
|
@ -124,7 +140,7 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public class MySqlItemHandler : MySqlInventoryHandler<XInventoryItem>
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MySqlItemHandler(string c, string t, string m) :
|
||||
base(c, t, m)
|
||||
|
@ -140,8 +156,7 @@ namespace OpenSim.Data.MySQL
|
|||
if (!base.Delete(field, val))
|
||||
return false;
|
||||
|
||||
// Don't increment folder version here since Delete(string, string) calls Delete(string[], string[])
|
||||
// IncrementFolderVersion(retrievedItems[0].parentFolderID);
|
||||
IncrementFolderVersion(retrievedItems[0].parentFolderID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -167,7 +182,7 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public bool MoveItem(string id, string newParent)
|
||||
{
|
||||
XInventoryItem[] retrievedItems = Get(new string[] { "inventoryID" }, new string[] { id });
|
||||
XInventoryItem[] retrievedItems = Get("inventoryID", id);
|
||||
if (retrievedItems.Length == 0)
|
||||
return false;
|
||||
|
||||
|
@ -183,8 +198,188 @@ namespace OpenSim.Data.MySQL
|
|||
return false;
|
||||
}
|
||||
|
||||
IncrementFolderVersion(oldParent);
|
||||
IncrementFolderVersion(newParent);
|
||||
if(oldParent.ToString() != newParent)
|
||||
IncrementFolderVersion(oldParent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MoveItems(string[] ids, string[] newParents)
|
||||
{
|
||||
int len = ids.Length;
|
||||
if(len == 0)
|
||||
return false;
|
||||
|
||||
MySqlConnection dbcon;
|
||||
MySqlCommand cmd;
|
||||
MySqlDataReader rdr;
|
||||
try
|
||||
{
|
||||
dbcon = new MySqlConnection(m_connectionString);
|
||||
dbcon.Open();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
HashSet<string> changedfolders = new HashSet<string>();
|
||||
try
|
||||
{
|
||||
UUID utmp;
|
||||
|
||||
int flast = len - 1;
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
sb.AppendFormat("select parentFolderID from {0} where inventoryID IN ('", m_Realm);
|
||||
for (int i = 0 ; i < len ; ++i)
|
||||
{
|
||||
sb.Append(ids[i]);
|
||||
if(i < flast)
|
||||
sb.Append("','");
|
||||
else
|
||||
sb.Append("')");
|
||||
}
|
||||
|
||||
string[] oldparents = new string[len];
|
||||
int l = 0;
|
||||
using (cmd = new MySqlCommand())
|
||||
{
|
||||
cmd.CommandText = sb.ToString();
|
||||
cmd.Connection = dbcon;
|
||||
rdr = cmd.ExecuteReader();
|
||||
while (rdr.Read() && l < len)
|
||||
{
|
||||
if(!(rdr[0] is string))
|
||||
oldparents[l++] = null;
|
||||
else
|
||||
oldparents[l++] = (string)rdr[0];
|
||||
}
|
||||
rdr.Close();
|
||||
}
|
||||
|
||||
if(l == 0)
|
||||
return false;
|
||||
|
||||
l = 0;
|
||||
sb = new StringBuilder(1024);
|
||||
string sbformat = String.Format("insert into {0} (inventoryID,parentFolderID) values{1} on duplicate key update parentFolderID = values(parentFolderID)", m_Realm,"{0}");
|
||||
|
||||
for(int k = 0; k < len; k++)
|
||||
{
|
||||
string oldid = oldparents[k];
|
||||
if(String.IsNullOrWhiteSpace(oldid) || !UUID.TryParse(oldid, out utmp))
|
||||
continue;
|
||||
|
||||
string newParent = newParents[k];
|
||||
if(String.IsNullOrWhiteSpace(newParent) || !UUID.TryParse(newParent, out utmp))
|
||||
continue;
|
||||
|
||||
string id = ids[k];
|
||||
if(id == oldid)
|
||||
continue;
|
||||
|
||||
sb.AppendFormat("(\'{0}\',\'{1}\')",id, newParent);
|
||||
if(k < flast)
|
||||
sb.Append(",");
|
||||
if(!changedfolders.Contains(newParent))
|
||||
changedfolders.Add(newParent);
|
||||
|
||||
if(!changedfolders.Contains(oldid))
|
||||
changedfolders.Add(oldid);
|
||||
|
||||
++l;
|
||||
}
|
||||
|
||||
|
||||
if(l == 0)
|
||||
return false;
|
||||
|
||||
oldparents = null;
|
||||
newParents = null;
|
||||
ids = null;
|
||||
|
||||
using (cmd = new MySqlCommand())
|
||||
{
|
||||
using(MySqlTransaction trans = dbcon.BeginTransaction())
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
cmd.Transaction = trans;
|
||||
|
||||
try
|
||||
{
|
||||
cmd.CommandText = string.Format(sbformat,sb.ToString());
|
||||
int r = cmd.ExecuteNonQuery();
|
||||
|
||||
if(r == 2 * l)
|
||||
trans.Commit();
|
||||
else
|
||||
{
|
||||
// we did got insertions so need to bail out
|
||||
trans.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
trans.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(changedfolders.Count == 0)
|
||||
return true;
|
||||
|
||||
sb = new StringBuilder(256);
|
||||
sb.Append("insert into inventoryfolders (folderID) values");
|
||||
|
||||
l = 0;
|
||||
flast = changedfolders.Count - 1;
|
||||
foreach(UUID uu in changedfolders)
|
||||
{
|
||||
sb.AppendFormat("(\'{0}\')",uu);
|
||||
if(l < flast)
|
||||
sb.Append(",");
|
||||
++l;
|
||||
}
|
||||
|
||||
changedfolders = null;
|
||||
|
||||
sb.Append(" on duplicate key update version = version + 1");
|
||||
using (cmd = new MySqlCommand())
|
||||
{
|
||||
using(MySqlTransaction trans = dbcon.BeginTransaction())
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
cmd.Transaction = trans;
|
||||
cmd.CommandText = sb.ToString();
|
||||
try
|
||||
{
|
||||
int r = cmd.ExecuteNonQuery();
|
||||
if(r == 2 * l)
|
||||
trans.Commit();
|
||||
else
|
||||
{
|
||||
// we did got insertions so need to bail out
|
||||
trans.Rollback();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
trans.Rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
dbcon.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -223,7 +418,6 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
|
||||
int perms = 0;
|
||||
|
||||
if (reader.Read())
|
||||
|
|
|
@ -74,6 +74,16 @@ namespace OpenSim.Data.PGSQL
|
|||
return m_Items.Get(fields, vals);
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetItems(string field, string[] vals)
|
||||
{
|
||||
return m_Items.Get(field, vals);
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetItems(string field, string id)
|
||||
{
|
||||
return m_Items.Get(field, id);
|
||||
}
|
||||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
if (folder.folderName.Length > 64)
|
||||
|
@ -116,6 +126,13 @@ namespace OpenSim.Data.PGSQL
|
|||
return m_Items.MoveItem(id, newParent);
|
||||
}
|
||||
|
||||
public bool MoveItems(string[] ids, string[] newParents)
|
||||
{
|
||||
for(int i = 0; i< ids.Length; ++i)
|
||||
m_Items.MoveItem(ids[i], newParents[i]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MoveFolder(string id, string newParent)
|
||||
{
|
||||
return m_Folders.MoveFolder(id, newParent);
|
||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
#if CSharpSqlite
|
||||
using Community.CsharpSqlite.Sqlite;
|
||||
|
@ -122,7 +123,44 @@ namespace OpenSim.Data.SQLite
|
|||
|
||||
public virtual T[] Get(string field, string key)
|
||||
{
|
||||
return Get(new string[] { field }, new string[] { key });
|
||||
List<string> terms = new List<string>();
|
||||
|
||||
using (SqliteCommand cmd = new SqliteCommand())
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":" + field, key));
|
||||
string query = String.Format("select * from {0} where `{1}` = :{1}",m_Realm, field);
|
||||
|
||||
cmd.CommandText = query;
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual T[] Get(string field, string[] keys)
|
||||
{
|
||||
int flen = keys.Length;
|
||||
if(flen == 0)
|
||||
return new T[0];
|
||||
|
||||
int flast = flen - 1;
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
sb.AppendFormat("select * from {0} where {1} IN('", m_Realm, field);
|
||||
|
||||
using (SqliteCommand cmd = new SqliteCommand())
|
||||
{
|
||||
for (int i = 0 ; i < flen ; i++)
|
||||
{
|
||||
sb.Append(keys[i]);
|
||||
if(i < flast)
|
||||
sb.Append("','");
|
||||
else
|
||||
sb.Append("')");
|
||||
}
|
||||
|
||||
cmd.CommandText = sb.ToString();
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual T[] Get(string[] fields, string[] keys)
|
||||
|
|
|
@ -70,6 +70,14 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
return m_Items.Get(fields, vals);
|
||||
}
|
||||
public XInventoryItem[] GetItems(string field, string[] vals)
|
||||
{
|
||||
return m_Items.Get(field, vals);
|
||||
}
|
||||
public XInventoryItem[] GetItems(string field, string val)
|
||||
{
|
||||
return m_Items.Get(field, val);
|
||||
}
|
||||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
|
@ -114,6 +122,13 @@ namespace OpenSim.Data.SQLite
|
|||
return m_Items.MoveItem(id, newParent);
|
||||
}
|
||||
|
||||
public bool MoveItems(string[] ids, string[] newParents)
|
||||
{
|
||||
for(int i = 0; i< ids.Length; ++i)
|
||||
m_Items.MoveItem(ids[i], newParents[i]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MoveFolder(string id, string newParent)
|
||||
{
|
||||
return m_Folders.MoveFolder(id, newParent);
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace OSHttpServer
|
|||
if (m_internalThread != null)
|
||||
return;
|
||||
|
||||
m_lastTimeOutCheckTime = GetTimeStampMS();
|
||||
m_lastTimeOutCheckTime = GetTimeStamp();
|
||||
using(ExecutionContext.SuppressFlow())
|
||||
m_internalThread = new Thread(ThreadRunProcess);
|
||||
|
||||
|
|
|
@ -1038,7 +1038,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
// Fire this out on a different thread so that we don't hold up outgoing packet processing for
|
||||
// everybody else if this is being called due to an ack timeout.
|
||||
// This is the same as processing as the async process of a logout request.
|
||||
Util.FireAndForget(
|
||||
o => DeactivateClientDueToTimeout(client, timeoutTicks), null, "LLUDPServer.DeactivateClientDueToTimeout");
|
||||
|
||||
|
@ -1760,19 +1759,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name='timeoutTicks'></param>
|
||||
protected void DeactivateClientDueToTimeout(LLClientView client, int timeoutTicks)
|
||||
{
|
||||
lock (client.CloseSyncLock)
|
||||
ClientLogoutsDueToNoReceives++;
|
||||
|
||||
if (client.SceneAgent != null)
|
||||
{
|
||||
ClientLogoutsDueToNoReceives++;
|
||||
|
||||
if (client.SceneAgent != null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
|
||||
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
|
||||
|
||||
if (!client.SceneAgent.IsChildAgent)
|
||||
client.Kick("Simulator logged you out due to connection timeout.");
|
||||
}
|
||||
m_log.WarnFormat(
|
||||
"[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
|
||||
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
|
||||
}
|
||||
|
||||
if (!Scene.CloseAgent(client.AgentId, true))
|
||||
|
|
|
@ -118,6 +118,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
return;
|
||||
|
||||
m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
if(m_invAccessModule is null)
|
||||
{
|
||||
Enabled = false;
|
||||
m_scene.UnregisterModuleInterface<IAttachmentsModule>(this);
|
||||
m_scene.EventManager.OnNewClient -= SubscribeToClientEvents;
|
||||
m_scene.EventManager.OnStartScript -= OnScriptStarted;
|
||||
m_scene.EventManager.OnStopScript -= OnScriptStopped;
|
||||
m_log.WarnFormat("[ATTACHMENTS MODULE]: InventoryService unvailable!. Module disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
m_regionConsole = scene.RequestModuleInterface<IRegionConsole>();
|
||||
if (m_regionConsole != null)
|
||||
{
|
||||
|
@ -365,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
for (int indx = 0; indx < ad.AttachmentObjects.Count; ++indx)
|
||||
{
|
||||
SceneObjectGroup sog = ad.AttachmentObjects[indx] as SceneObjectGroup;
|
||||
if(sog != null)
|
||||
if(sog != null && sog.OwnerID.Equals(sp.UUID))
|
||||
{
|
||||
sog.LocalId = 0;
|
||||
sog.RootPart.ClearUpdateSchedule();
|
||||
|
@ -983,81 +994,89 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// <param name="saveAllScripted"></param>
|
||||
private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, string scriptedState)
|
||||
{
|
||||
if (!grp.HasGroupChanged)
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
}
|
||||
return;
|
||||
}
|
||||
grp.HasGroupChanged = false;
|
||||
|
||||
if (m_invAccessModule is null)
|
||||
return;
|
||||
|
||||
if (grp.FromItemID.IsZero())
|
||||
{
|
||||
// We can't save temp attachments
|
||||
grp.HasGroupChanged = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(sp.IsNPC)
|
||||
return;
|
||||
|
||||
if (grp.HasGroupChanged)
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
|
||||
InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, grp.FromItemID);
|
||||
if (item != null)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState);
|
||||
|
||||
InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, grp.FromItemID);
|
||||
|
||||
if (item != null)
|
||||
if (item.Owner.NotEqual(sp.UUID))
|
||||
{
|
||||
// attach is rez, need to update permissions
|
||||
item.Flags &= ~(uint)(InventoryItemFlags.ObjectSlamPerm | InventoryItemFlags.ObjectOverwriteBase |
|
||||
InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup |
|
||||
InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
|
||||
|
||||
uint permsBase = (uint)(PermissionMask.Copy | PermissionMask.Transfer |
|
||||
PermissionMask.Modify | PermissionMask.Move |
|
||||
PermissionMask.Export | PermissionMask.FoldedMask);
|
||||
|
||||
permsBase &= grp.CurrentAndFoldedNextPermissions();
|
||||
permsBase |= (uint)PermissionMask.Move;
|
||||
item.BasePermissions = permsBase;
|
||||
item.CurrentPermissions = permsBase;
|
||||
item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask | (uint)PermissionMask.Move;
|
||||
item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask;
|
||||
item.GroupPermissions = permsBase & grp.RootPart.GroupMask;
|
||||
item.CurrentPermissions &=
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify |
|
||||
(uint)PermissionMask.Move |
|
||||
(uint)PermissionMask.Export |
|
||||
(uint)PermissionMask.FoldedMask); // Preserve folded permissions ??
|
||||
|
||||
string name = grp.RootPart.Name;
|
||||
string desc = grp.RootPart.Description;
|
||||
|
||||
AssetBase asset = m_scene.CreateAsset(
|
||||
name, desc,
|
||||
(sbyte)AssetType.Object,
|
||||
Utils.StringToBytes(sceneObjectXml),
|
||||
sp.UUID);
|
||||
|
||||
item.Name = name;
|
||||
item.Description = desc;
|
||||
item.AssetID = asset.FullID;
|
||||
item.AssetType = (int)AssetType.Object;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
|
||||
if (m_invAccessModule != null)
|
||||
m_invAccessModule.UpdateInventoryItemAsset(sp.UUID, item, asset);
|
||||
|
||||
if (sp.ControllingClient != null)
|
||||
sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
m_log.DebugFormat("[ATTACHMENTS MODULE]: Updating asset for attachment owner mismach: agent {0}, owner {1}",
|
||||
sp.UUID, item.Owner);
|
||||
return;
|
||||
}
|
||||
|
||||
grp.HasGroupChanged = false; // Prevent it being saved over and over
|
||||
}
|
||||
else if (DebugLevel > 0)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState);
|
||||
// attach is rez, need to update permissions
|
||||
item.Flags &= ~(uint)(InventoryItemFlags.ObjectSlamPerm | InventoryItemFlags.ObjectOverwriteBase |
|
||||
InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup |
|
||||
InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
|
||||
|
||||
uint permsBase = (uint)(PermissionMask.Copy | PermissionMask.Transfer |
|
||||
PermissionMask.Modify | PermissionMask.Move |
|
||||
PermissionMask.Export | PermissionMask.FoldedMask);
|
||||
|
||||
permsBase &= grp.CurrentAndFoldedNextPermissions();
|
||||
permsBase |= (uint)PermissionMask.Move;
|
||||
item.BasePermissions = permsBase;
|
||||
item.CurrentPermissions = permsBase;
|
||||
item.NextPermissions = permsBase & grp.RootPart.NextOwnerMask | (uint)PermissionMask.Move;
|
||||
item.EveryOnePermissions = permsBase & grp.RootPart.EveryoneMask;
|
||||
item.GroupPermissions = permsBase & grp.RootPart.GroupMask;
|
||||
item.CurrentPermissions &=
|
||||
((uint)PermissionMask.Copy |
|
||||
(uint)PermissionMask.Transfer |
|
||||
(uint)PermissionMask.Modify |
|
||||
(uint)PermissionMask.Move |
|
||||
(uint)PermissionMask.Export |
|
||||
(uint)PermissionMask.FoldedMask); // Preserve folded permissions ??
|
||||
|
||||
string name = grp.RootPart.Name;
|
||||
string desc = grp.RootPart.Description;
|
||||
|
||||
AssetBase asset = m_scene.CreateAsset(
|
||||
name, desc,
|
||||
(sbyte)AssetType.Object,
|
||||
Utils.StringToBytes(sceneObjectXml),
|
||||
sp.UUID);
|
||||
|
||||
item.Name = name;
|
||||
item.Description = desc;
|
||||
item.AssetID = asset.FullID;
|
||||
item.AssetType = (int)AssetType.Object;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
|
||||
if (!m_invAccessModule.UpdateInventoryItemAsset(sp.UUID, item, asset))
|
||||
return;
|
||||
|
||||
if (sp.ControllingClient != null)
|
||||
sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
public void TestLoadIarPathWithEscapedChars()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
string itemName = "You & you are a mean/man/";
|
||||
string humanEscapedItemName = @"You & you are a mean\/man\/";
|
||||
|
@ -168,6 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
item1.Name = itemName;
|
||||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
item1.Owner = userId;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
|
|
|
@ -118,6 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
|
||||
MemoryStream archiveWriteStream = new MemoryStream();
|
||||
|
||||
//InventoryFolderBase objects = scene.InventoryService.GetFolderForType(m_uaLL1.PrincipalID, FolderType.Object);
|
||||
// Create scene object asset
|
||||
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
|
||||
SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50);
|
||||
|
@ -134,6 +135,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
item1.GroupID = UUID.Random();
|
||||
item1.CreatorId = m_uaLL1.PrincipalID.ToString();
|
||||
item1.Owner = m_uaLL1.PrincipalID;
|
||||
//item1.Folder = objects.ID;
|
||||
item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
|
||||
scene.AddInventoryItem(item1);
|
||||
|
||||
|
@ -157,6 +159,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
|||
coaItem.GroupID = UUID.Random();
|
||||
coaItem.CreatorId = m_uaLL1.PrincipalID.ToString();
|
||||
coaItem.Owner = m_uaLL1.PrincipalID;
|
||||
//coaItem.Folder = objects.ID;
|
||||
coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
|
||||
scene.AddInventoryItem(coaItem);
|
||||
|
||||
|
|
|
@ -322,6 +322,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
if (item == null || item.AssetID.IsZero())
|
||||
return null;
|
||||
|
||||
if (attachment && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) != 0)
|
||||
{
|
||||
if (remoteClient != null && remoteClient.IsActive)
|
||||
remoteClient.SendAlertMessage("You can't attach multiple objects to one spot");
|
||||
return null;
|
||||
}
|
||||
|
||||
string userAssetServer;
|
||||
if (IsForeignUser(remoteClient.AgentId, out userAssetServer))
|
||||
{
|
||||
|
|
|
@ -926,6 +926,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
if (item == null)
|
||||
return null;
|
||||
|
||||
if (attachment && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) != 0)
|
||||
{
|
||||
if (remoteClient != null && remoteClient.IsActive)
|
||||
remoteClient.SendAlertMessage("You can't attach multiple objects to one spot");
|
||||
return null;
|
||||
}
|
||||
|
||||
item.Owner = remoteClient.AgentId;
|
||||
|
||||
return RezObject(
|
||||
|
@ -1055,13 +1062,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
group = objlist[i];
|
||||
SceneObjectPart rootPart = group.RootPart;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
|
||||
// group.Name, group.LocalId, group.UUID,
|
||||
// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
|
||||
// remoteClient.Name);
|
||||
//m_log.DebugFormat(
|
||||
// "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
|
||||
// group.Name, group.LocalId, group.UUID,
|
||||
// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
|
||||
// remoteClient.Name);
|
||||
|
||||
// Vector3 storedPosition = group.AbsolutePosition;
|
||||
//Vector3 storedPosition = group.AbsolutePosition;
|
||||
if (group.UUID.IsZero())
|
||||
{
|
||||
m_log.Debug("[INVENTORY ACCESS MODULE]: Object has UUID.Zero! Position 3");
|
||||
|
@ -1081,9 +1088,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
foreach (SceneObjectPart part in group.Parts)
|
||||
{
|
||||
// Make the rezzer the owner, as this is not necessarily set correctly in the serialized asset.
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = remoteClient.AgentId;
|
||||
part.RezzerID = remoteClient.AgentId;
|
||||
if (part.OwnerID.NotEqual(remoteClient.AgentId))
|
||||
{
|
||||
if (part.OwnerID.NotEqual(part.GroupID))
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = remoteClient.AgentId;
|
||||
part.RezzerID = remoteClient.AgentId;
|
||||
part.Inventory.ChangeInventoryOwner(remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
|||
XmlDocument ncAssetGetXmlDoc = new XmlDocument();
|
||||
ncAssetGetXmlDoc.LoadXml(xmlData);
|
||||
|
||||
// Console.WriteLine(ncAssetGetXmlDoc.OuterXml);
|
||||
// Console.WriteLine(ncAssetGetXmlDoc.OuterXml);
|
||||
|
||||
XmlNodeList creatorDataNodes = ncAssetGetXmlDoc.GetElementsByTagName("CreatorData");
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
|||
private void RezScript(Scene scene, UUID soId, string script, string itemName, UUID userId)
|
||||
{
|
||||
InventoryItemBase itemTemplate = new InventoryItemBase();
|
||||
// itemTemplate.ID = itemId;
|
||||
// itemTemplate.ID = itemId;
|
||||
itemTemplate.Name = itemName;
|
||||
itemTemplate.Folder = soId;
|
||||
itemTemplate.InvType = (int)InventoryType.LSL;
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
|||
public void TestRezObject()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// Create asset
|
||||
SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40);
|
||||
|
@ -159,6 +159,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
|
|||
item1.Name = item1Name;
|
||||
item1.AssetID = asset1.FullID;
|
||||
item1.ID = item1Id;
|
||||
item1.Owner = m_userId;
|
||||
InventoryFolderBase objsFolder
|
||||
= InventoryArchiveUtils.FindFoldersByPath(m_scene.InventoryService, m_userId, "Objects")[0];
|
||||
item1.Folder = objsFolder.ID;
|
||||
|
|
|
@ -689,8 +689,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
{
|
||||
if (resStream != null)
|
||||
resStream.Close();
|
||||
if (response != null)
|
||||
response.Close();
|
||||
|
||||
if(!Removed)
|
||||
{
|
||||
|
@ -770,6 +768,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
RequestModule.GotCompletedRequest(this);
|
||||
}
|
||||
}
|
||||
if (response != null)
|
||||
response.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// The inventory item. Null if no such item was found.
|
||||
/// </returns>
|
||||
TaskInventoryItem GetInventoryItem(string name);
|
||||
|
||||
TaskInventoryItem GetInventoryItem(string name, int assetType);
|
||||
/// <summary>
|
||||
/// Get inventory items by name.
|
||||
/// </summary>
|
||||
|
|
|
@ -1095,6 +1095,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return null;
|
||||
}
|
||||
|
||||
public TaskInventoryItem GetInventoryItem(string name, int type)
|
||||
{
|
||||
m_items.LockItemsForRead(true);
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.Type == type && item.Name == name)
|
||||
{
|
||||
m_items.LockItemsForRead(false);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
m_items.LockItemsForRead(false);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<TaskInventoryItem> GetInventoryItems(string name)
|
||||
{
|
||||
List<TaskInventoryItem> items = new List<TaskInventoryItem>();
|
||||
|
|
|
@ -46,9 +46,9 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
|
|||
/// <param name='type'></param>
|
||||
public static UUID GetAssetIdFromItemName(SceneObjectPart part, string name, int type)
|
||||
{
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(name);
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(name, type);
|
||||
|
||||
if (item != null && item.Type == type)
|
||||
if (item != null)
|
||||
return item.AssetID;
|
||||
else
|
||||
return UUID.Zero;
|
||||
|
@ -98,8 +98,8 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
|
|||
|
||||
if (part.Inventory != null)
|
||||
{
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
|
||||
if (item != null && item.Type == (int)type)
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier, (int)type);
|
||||
if (item != null)
|
||||
return item.AssetID;
|
||||
}
|
||||
|
||||
|
@ -114,15 +114,15 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
|
|||
TaskInventoryItem item;
|
||||
if (part.Inventory != null)
|
||||
{
|
||||
item = part.Inventory.GetInventoryItem(identifier);
|
||||
if (item != null && item.Type == (int)type)
|
||||
item = part.Inventory.GetInventoryItem(identifier, (int)type);
|
||||
if (item != null)
|
||||
return item.AssetID;
|
||||
}
|
||||
|
||||
if (part.LocalId != host.LocalId && host.Inventory != null)
|
||||
{
|
||||
item = host.Inventory.GetInventoryItem(identifier);
|
||||
if (item != null && item.Type == (int)type)
|
||||
item = host.Inventory.GetInventoryItem(identifier, (int)type);
|
||||
if (item != null)
|
||||
return item.AssetID;
|
||||
}
|
||||
return UUID.Zero;
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Tests
|
|||
public void TestRezObjectFromInventoryItem()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
|
||||
|
@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Tests
|
|||
Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos));
|
||||
|
||||
// Velocity doesn't get applied, probably because there is no physics in tests (yet)
|
||||
// Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel));
|
||||
//Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel));
|
||||
Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero));
|
||||
|
||||
// Confusingly, this isn't the rezzedObject.Rotation
|
||||
|
|
|
@ -109,7 +109,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
| GroupPowers.SendNotices
|
||||
| GroupPowers.SetLandingPoint
|
||||
| GroupPowers.StartProposal
|
||||
| GroupPowers.VoteOnProposal;
|
||||
| GroupPowers.VoteOnProposal
|
||||
| GroupPowers.ExperienceAdmin
|
||||
| GroupPowers.ExperienceCreator
|
||||
| GroupPowers.GroupBanAccess
|
||||
| GroupPowers.HostEvent;
|
||||
|
||||
private bool m_connectorEnabled = false;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -68,7 +68,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Vector3 _position;
|
||||
private SafeNativeMethods.Vector3 _zeroPosition;
|
||||
private OdeNative.Vector3 _zeroPosition;
|
||||
private bool _zeroFlag = false;
|
||||
private bool m_lastUpdateSent = false;
|
||||
private Vector3 _velocity;
|
||||
|
@ -151,7 +151,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
internal IntPtr Shell { get; private set; }
|
||||
|
||||
private IntPtr Amotor = IntPtr.Zero;
|
||||
private SafeNativeMethods.Mass ShellMass;
|
||||
private OdeNative.Mass ShellMass;
|
||||
|
||||
private int m_eventsubscription = 0;
|
||||
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||
|
@ -569,12 +569,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane;
|
||||
|
||||
//m_log.Debug("[ODE CHARACTER]: changing avatar tilt");
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, yTiltComponent); // same as lowstop
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, yTiltComponent); // same as lowstop
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -812,11 +812,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_pidControllerActive == false)
|
||||
{
|
||||
_zeroPosition = SafeNativeMethods.BodyGetPosition(Body);
|
||||
_zeroPosition = OdeNative.BodyGetPosition(Body);
|
||||
}
|
||||
//PidStatus = true;
|
||||
|
||||
SafeNativeMethods.Vector3 localpos = SafeNativeMethods.BodyGetPosition(Body);
|
||||
OdeNative.Vector3 localpos = OdeNative.BodyGetPosition(Body);
|
||||
Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z);
|
||||
|
||||
if (!localPos.IsFinite())
|
||||
|
@ -831,7 +831,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
|
||||
Vector3 vec = Vector3.Zero;
|
||||
SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body);
|
||||
OdeNative.Vector3 vel = OdeNative.BodyGetLinearVel(Body);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ODE CHARACTER]: Current velocity in Move() is <{0},{1},{2}>, target {3} for {4}",
|
||||
|
@ -855,7 +855,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (!_zeroFlag)
|
||||
{
|
||||
_zeroFlag = true;
|
||||
_zeroPosition = SafeNativeMethods.BodyGetPosition(Body);
|
||||
_zeroPosition = OdeNative.BodyGetPosition(Body);
|
||||
}
|
||||
|
||||
if (m_pidControllerActive)
|
||||
|
@ -865,7 +865,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// Avatar to Avatar collisions
|
||||
// Prim to avatar collisions
|
||||
|
||||
SafeNativeMethods.Vector3 pos = SafeNativeMethods.BodyGetPosition(Body);
|
||||
OdeNative.Vector3 pos = OdeNative.BodyGetPosition(Body);
|
||||
vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2);
|
||||
vec.Y = (_target_velocity.Y - vel.Y) * (PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2);
|
||||
if (flying)
|
||||
|
@ -913,7 +913,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
// We're colliding with something and we're not flying but we're moving
|
||||
// This means we're walking or running.
|
||||
SafeNativeMethods.Vector3 pos = SafeNativeMethods.BodyGetPosition(Body);
|
||||
OdeNative.Vector3 pos = OdeNative.BodyGetPosition(Body);
|
||||
vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P;
|
||||
vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
|
||||
vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
|
||||
|
@ -947,7 +947,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (vec.IsFinite())
|
||||
{
|
||||
// Apply the total force acting on this avatar
|
||||
SafeNativeMethods.BodyAddForce(Body, vec.X, vec.Y, vec.Z);
|
||||
OdeNative.BodyAddForce(Body, vec.X, vec.Y, vec.Z);
|
||||
|
||||
if (!_zeroFlag)
|
||||
AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
|
||||
|
@ -963,7 +963,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
return;
|
||||
}
|
||||
|
||||
SafeNativeMethods.Vector3 newVel = SafeNativeMethods.BodyGetLinearVel(Body);
|
||||
OdeNative.Vector3 newVel = OdeNative.BodyGetLinearVel(Body);
|
||||
if (newVel.X >= 256 || newVel.X <= 256 || newVel.Y >= 256 || newVel.Y <= 256 || newVel.Z >= 256 || newVel.Z <= 256)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
|
@ -979,7 +979,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
else
|
||||
newVel.Z = Util.Clamp<float>(newVel.Z, -255f, 255f);
|
||||
|
||||
SafeNativeMethods.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
|
||||
OdeNative.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -992,16 +992,16 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
internal void UpdatePositionAndVelocity(List<OdeCharacter> defects)
|
||||
{
|
||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
||||
SafeNativeMethods.Vector3 newPos;
|
||||
OdeNative.Vector3 newPos;
|
||||
try
|
||||
{
|
||||
newPos = SafeNativeMethods.BodyGetPosition(Body);
|
||||
newPos = OdeNative.BodyGetPosition(Body);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
bad = true;
|
||||
defects.Add(this);
|
||||
newPos = new SafeNativeMethods.Vector3(_position.X, _position.Y, _position.Z);
|
||||
newPos = new OdeNative.Vector3(_position.X, _position.Y, _position.Z);
|
||||
base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
|
||||
m_log.WarnFormat("[ODE CHARACTER]: Avatar Null reference for Avatar {0}, physical actor {1}", Name, m_uuid);
|
||||
|
||||
|
@ -1038,11 +1038,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
else
|
||||
{
|
||||
m_lastUpdateSent = false;
|
||||
SafeNativeMethods.Vector3 newVelocity;
|
||||
OdeNative.Vector3 newVelocity;
|
||||
|
||||
try
|
||||
{
|
||||
newVelocity = SafeNativeMethods.BodyGetLinearVel(Body);
|
||||
newVelocity = OdeNative.BodyGetLinearVel(Body);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
|
@ -1109,14 +1109,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
|
||||
// lock (OdeScene.UniversalColliderSyncObject)
|
||||
Shell = SafeNativeMethods.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||
Shell = OdeNative.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||
|
||||
SafeNativeMethods.GeomSetCategoryBits(Shell, (uint)m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(Shell, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCategoryBits(Shell, (uint)m_collisionCategories);
|
||||
OdeNative.GeomSetCollideBits(Shell, (uint)m_collisionFlags);
|
||||
|
||||
SafeNativeMethods.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||
Body = SafeNativeMethods.BodyCreate(_parent_scene.world);
|
||||
SafeNativeMethods.BodySetPosition(Body, npositionX, npositionY, npositionZ);
|
||||
OdeNative.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
|
||||
Body = OdeNative.BodyCreate(_parent_scene.world);
|
||||
OdeNative.BodySetPosition(Body, npositionX, npositionY, npositionZ);
|
||||
|
||||
_position.X = npositionX;
|
||||
_position.Y = npositionY;
|
||||
|
@ -1124,45 +1124,45 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
m_taintPosition = _position;
|
||||
|
||||
SafeNativeMethods.BodySetMass(Body, ref ShellMass);
|
||||
SafeNativeMethods.Matrix3 m_caprot;
|
||||
OdeNative.BodySetMass(Body, ref ShellMass);
|
||||
OdeNative.Matrix3 m_caprot;
|
||||
// 90 Stand up on the cap of the capped cyllinder
|
||||
if (_parent_scene.IsAvCapsuleTilted)
|
||||
{
|
||||
SafeNativeMethods.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
|
||||
OdeNative.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeNativeMethods.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
|
||||
OdeNative.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
|
||||
}
|
||||
|
||||
SafeNativeMethods.GeomSetRotation(Shell, ref m_caprot);
|
||||
SafeNativeMethods.BodySetRotation(Body, ref m_caprot);
|
||||
OdeNative.GeomSetRotation(Shell, ref m_caprot);
|
||||
OdeNative.BodySetRotation(Body, ref m_caprot);
|
||||
|
||||
SafeNativeMethods.GeomSetBody(Shell, Body);
|
||||
OdeNative.GeomSetBody(Shell, Body);
|
||||
|
||||
// The purpose of the AMotor here is to keep the avatar's physical
|
||||
// surrogate from rotating while moving
|
||||
Amotor = SafeNativeMethods.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
|
||||
SafeNativeMethods.JointAttach(Amotor, Body, IntPtr.Zero);
|
||||
SafeNativeMethods.JointSetAMotorMode(Amotor, dAMotorEuler);
|
||||
SafeNativeMethods.JointSetAMotorNumAxes(Amotor, 3);
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, 0, 0);
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, 1, 0);
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, 2, 0);
|
||||
Amotor = OdeNative.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
|
||||
OdeNative.JointAttach(Amotor, Body, IntPtr.Zero);
|
||||
OdeNative.JointSetAMotorMode(Amotor, dAMotorEuler);
|
||||
OdeNative.JointSetAMotorNumAxes(Amotor, 3);
|
||||
OdeNative.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
|
||||
OdeNative.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
|
||||
OdeNative.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
|
||||
OdeNative.JointSetAMotorAngle(Amotor, 0, 0);
|
||||
OdeNative.JointSetAMotorAngle(Amotor, 1, 0);
|
||||
OdeNative.JointSetAMotorAngle(Amotor, 2, 0);
|
||||
|
||||
// These lowstops and high stops are effectively (no wiggle room)
|
||||
if (_parent_scene.IsAvCapsuleTilted)
|
||||
{
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1174,18 +1174,18 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// to be comprehended in their entirety.
|
||||
#endregion
|
||||
AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop
|
||||
}
|
||||
|
||||
// Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the
|
||||
// capped cyllinder will fall over
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor);
|
||||
|
||||
//d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
|
||||
//d.QfromR(
|
||||
|
@ -1224,7 +1224,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (Amotor != IntPtr.Zero)
|
||||
{
|
||||
// Kill the Amotor
|
||||
SafeNativeMethods.JointDestroy(Amotor);
|
||||
OdeNative.JointDestroy(Amotor);
|
||||
Amotor = IntPtr.Zero;
|
||||
}
|
||||
|
||||
|
@ -1234,14 +1234,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
//kill the body
|
||||
SafeNativeMethods.BodyDestroy(Body);
|
||||
OdeNative.BodyDestroy(Body);
|
||||
Body = IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (Shell != IntPtr.Zero)
|
||||
{
|
||||
// lock (OdeScene.UniversalColliderSyncObject)
|
||||
SafeNativeMethods.GeomDestroy(Shell);
|
||||
OdeNative.GeomDestroy(Shell);
|
||||
|
||||
_parent_scene.geom_name_map.Remove(Shell);
|
||||
_parent_scene.actor_name_map.Remove(Shell);
|
||||
|
@ -1332,7 +1332,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z);
|
||||
OdeNative.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z);
|
||||
_position = m_taintPosition;
|
||||
}
|
||||
}
|
||||
|
@ -1344,7 +1344,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// FIXME: This is not a good solution since it's subject to a race condition if a force is another
|
||||
// thread sets a new force while we're in this loop (since it could be obliterated by
|
||||
// m_taintForce = Vector3.Zero. Need to lock ProcessTaints() when we set a new tainted force.
|
||||
SafeNativeMethods.BodyAddForce(Body, m_taintForce.X, m_taintForce.Y, m_taintForce.Z);
|
||||
OdeNative.BodyAddForce(Body, m_taintForce.X, m_taintForce.Y, m_taintForce.Z);
|
||||
}
|
||||
|
||||
m_taintForce = Vector3.Zero;
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
private float m_linearMotorDecayTimescale = 0;
|
||||
private float m_linearMotorTimescale = 0;
|
||||
private Vector3 m_lastLinearVelocityVector = Vector3.Zero;
|
||||
private SafeNativeMethods.Vector3 m_lastPositionVector = new SafeNativeMethods.Vector3();
|
||||
private OdeNative.Vector3 m_lastPositionVector = new OdeNative.Vector3();
|
||||
// private bool m_LinearMotorSetLastFrame = false;
|
||||
// private Vector3 m_linearMotorOffset = Vector3.Zero;
|
||||
|
||||
|
@ -611,7 +611,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
m_lastLinearVelocityVector = Vector3.Zero;
|
||||
m_lastAngularVelocity = Vector3.Zero;
|
||||
m_lastPositionVector = SafeNativeMethods.BodyGetPosition(Body);
|
||||
m_lastPositionVector = OdeNative.BodyGetPosition(Body);
|
||||
}
|
||||
|
||||
internal void Step(float pTimestep, OdeScene pParentScene)
|
||||
|
@ -631,8 +631,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
if (!m_linearMotorDirection.ApproxEquals(Vector3.Zero, 0.01f)) // requested m_linearMotorDirection is significant
|
||||
{
|
||||
if (!SafeNativeMethods.BodyIsEnabled(Body))
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
if (!OdeNative.BodyIsEnabled(Body))
|
||||
OdeNative.BodyEnable(Body);
|
||||
|
||||
// add drive to body
|
||||
Vector3 addAmount = m_linearMotorDirection/(m_linearMotorTimescale/pTimestep);
|
||||
|
@ -662,7 +662,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
// convert requested object velocity to world-referenced vector
|
||||
m_dir = m_lastLinearVelocityVector;
|
||||
SafeNativeMethods.Quaternion rot = SafeNativeMethods.BodyGetQuaternion(Body);
|
||||
OdeNative.Quaternion rot = OdeNative.BodyGetQuaternion(Body);
|
||||
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
|
||||
|
||||
|
@ -673,15 +673,15 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
Vector3 grav = Vector3.Zero;
|
||||
// There is some gravity, make a gravity force vector
|
||||
// that is applied after object velocity.
|
||||
SafeNativeMethods.Mass objMass;
|
||||
SafeNativeMethods.BodyGetMass(Body, out objMass);
|
||||
OdeNative.Mass objMass;
|
||||
OdeNative.BodyGetMass(Body, out objMass);
|
||||
// m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
|
||||
grav.Z = _pParentScene.gravityz * objMass.mass * (1f - m_VehicleBuoyancy);
|
||||
// Preserve the current Z velocity
|
||||
SafeNativeMethods.Vector3 vel_now = SafeNativeMethods.BodyGetLinearVel(Body);
|
||||
OdeNative.Vector3 vel_now = OdeNative.BodyGetLinearVel(Body);
|
||||
m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
|
||||
|
||||
SafeNativeMethods.Vector3 pos = SafeNativeMethods.BodyGetPosition(Body);
|
||||
OdeNative.Vector3 pos = OdeNative.BodyGetPosition(Body);
|
||||
// Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f);
|
||||
Vector3 posChange = new Vector3();
|
||||
posChange.X = pos.X - m_lastPositionVector.X;
|
||||
|
@ -693,33 +693,33 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (pos.X >= (m_BlockingEndPoint.X - (float)1))
|
||||
{
|
||||
pos.X -= posChange.X + 1;
|
||||
SafeNativeMethods.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
OdeNative.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
if (pos.Y >= (m_BlockingEndPoint.Y - (float)1))
|
||||
{
|
||||
pos.Y -= posChange.Y + 1;
|
||||
SafeNativeMethods.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
OdeNative.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
if (pos.Z >= (m_BlockingEndPoint.Z - (float)1))
|
||||
{
|
||||
pos.Z -= posChange.Z + 1;
|
||||
SafeNativeMethods.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
OdeNative.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
if (pos.X <= 0)
|
||||
{
|
||||
pos.X += posChange.X + 1;
|
||||
SafeNativeMethods.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
OdeNative.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
if (pos.Y <= 0)
|
||||
{
|
||||
pos.Y += posChange.Y + 1;
|
||||
SafeNativeMethods.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
OdeNative.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
}
|
||||
if (pos.Z < _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y))
|
||||
{
|
||||
pos.Z = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + 2;
|
||||
SafeNativeMethods.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
OdeNative.BodySetPosition(Body, pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
|
||||
// Check if hovering
|
||||
|
@ -748,7 +748,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
if ((pos.Z - m_VhoverTargetHeight) > .2 || (pos.Z - m_VhoverTargetHeight) < -.2)
|
||||
{
|
||||
SafeNativeMethods.BodySetPosition(Body, pos.X, pos.Y, m_VhoverTargetHeight);
|
||||
OdeNative.BodySetPosition(Body, pos.X, pos.Y, m_VhoverTargetHeight);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -815,12 +815,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
m_dir.Z = 0;
|
||||
}
|
||||
|
||||
m_lastPositionVector = SafeNativeMethods.BodyGetPosition(Body);
|
||||
m_lastPositionVector = OdeNative.BodyGetPosition(Body);
|
||||
|
||||
// Apply velocity
|
||||
SafeNativeMethods.BodySetLinearVel(Body, m_dir.X, m_dir.Y, m_dir.Z);
|
||||
OdeNative.BodySetLinearVel(Body, m_dir.X, m_dir.Y, m_dir.Z);
|
||||
// apply gravity force
|
||||
SafeNativeMethods.BodyAddForce(Body, grav.X, grav.Y, grav.Z);
|
||||
OdeNative.BodyAddForce(Body, grav.X, grav.Y, grav.Z);
|
||||
|
||||
|
||||
// apply friction
|
||||
|
@ -841,7 +841,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
*/
|
||||
|
||||
// Get what the body is doing, this includes 'external' influences
|
||||
SafeNativeMethods.Vector3 angularVelocity = SafeNativeMethods.BodyGetAngularVel(Body);
|
||||
OdeNative.Vector3 angularVelocity = OdeNative.BodyGetAngularVel(Body);
|
||||
// Vector3 angularVelocity = Vector3.Zero;
|
||||
|
||||
if (m_angularMotorApply > 0)
|
||||
|
@ -874,7 +874,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
float VAservo = 0.2f / (m_verticalAttractionTimescale * pTimestep);
|
||||
// get present body rotation
|
||||
SafeNativeMethods.Quaternion rot = SafeNativeMethods.BodyGetQuaternion(Body);
|
||||
OdeNative.Quaternion rot = OdeNative.BodyGetQuaternion(Body);
|
||||
Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W);
|
||||
// make a vector pointing up
|
||||
Vector3 verterr = Vector3.Zero;
|
||||
|
@ -923,7 +923,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (!m_lastAngularVelocity.ApproxEquals(Vector3.Zero, 0.01f))
|
||||
{
|
||||
if (!SafeNativeMethods.BodyIsEnabled (Body)) SafeNativeMethods.BodyEnable (Body);
|
||||
if (!OdeNative.BodyIsEnabled (Body)) OdeNative.BodyEnable (Body);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -935,14 +935,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
m_lastAngularVelocity -= m_lastAngularVelocity * decayamount;
|
||||
|
||||
// Apply to the body
|
||||
SafeNativeMethods.BodySetAngularVel (Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z);
|
||||
OdeNative.BodySetAngularVel (Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z);
|
||||
|
||||
} //end MoveAngular
|
||||
internal void LimitRotation(float timestep)
|
||||
{
|
||||
SafeNativeMethods.Quaternion rot = SafeNativeMethods.BodyGetQuaternion(Body);
|
||||
OdeNative.Quaternion rot = OdeNative.BodyGetQuaternion(Body);
|
||||
Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object
|
||||
SafeNativeMethods.Quaternion m_rot = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.Quaternion m_rot = new OdeNative.Quaternion();
|
||||
bool changed = false;
|
||||
m_rot.X = rotq.X;
|
||||
m_rot.Y = rotq.Y;
|
||||
|
@ -975,7 +975,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
changed = true;
|
||||
}
|
||||
if (changed)
|
||||
SafeNativeMethods.BodySetQuaternion(Body, ref m_rot);
|
||||
OdeNative.BodySetQuaternion(Body, ref m_rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,11 +66,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
return;
|
||||
|
||||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("ode.dll");
|
||||
Util.LoadArchSpecificWindowsDll("ubode.dll");
|
||||
|
||||
// Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
|
||||
// http://opensimulator.org/mantis/view.php?id=2750).
|
||||
SafeNativeMethods.InitODE();
|
||||
OdeNative.InitODE();
|
||||
|
||||
m_scene = new OdeScene(scene, m_config, Name, Version);
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
public IntPtr Body = IntPtr.Zero;
|
||||
private Vector3 _target_velocity;
|
||||
private SafeNativeMethods.Mass pMass;
|
||||
private OdeNative.Mass pMass;
|
||||
|
||||
private int m_eventsubscription;
|
||||
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||
|
@ -356,13 +356,13 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_assetFailed)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
}
|
||||
|
||||
_parent_scene.geom_name_map[prim_geom] = Name;
|
||||
|
@ -386,7 +386,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
if (IsPhysical && Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
OdeNative.BodyEnable(Body);
|
||||
if (m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||
m_vehicle.Enable(Body, _parent_scene);
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (IsPhysical && Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodyDisable(Body);
|
||||
OdeNative.BodyDisable(Body);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,22 +415,22 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (!childPrim)
|
||||
{
|
||||
// Sets the geom to a body
|
||||
Body = SafeNativeMethods.BodyCreate(_parent_scene.world);
|
||||
Body = OdeNative.BodyCreate(_parent_scene.world);
|
||||
|
||||
setMass();
|
||||
SafeNativeMethods.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
OdeNative.Quaternion myrot = new OdeNative.Quaternion();
|
||||
myrot.X = _orientation.X;
|
||||
myrot.Y = _orientation.Y;
|
||||
myrot.Z = _orientation.Z;
|
||||
myrot.W = _orientation.W;
|
||||
SafeNativeMethods.BodySetQuaternion(Body, ref myrot);
|
||||
SafeNativeMethods.GeomSetBody(prim_geom, Body);
|
||||
OdeNative.BodySetQuaternion(Body, ref myrot);
|
||||
OdeNative.GeomSetBody(prim_geom, Body);
|
||||
|
||||
if (m_assetFailed)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -438,14 +438,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
|
||||
}
|
||||
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
|
||||
SafeNativeMethods.BodySetAutoDisableFlag(Body, true);
|
||||
SafeNativeMethods.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
||||
OdeNative.BodySetAutoDisableFlag(Body, true);
|
||||
OdeNative.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
||||
|
||||
// disconnect from world gravity so we can apply buoyancy
|
||||
SafeNativeMethods.BodySetGravityMode (Body, false);
|
||||
OdeNative.BodySetGravityMode (Body, false);
|
||||
|
||||
m_interpenetrationcount = 0;
|
||||
m_collisionscore = 0;
|
||||
|
@ -787,8 +787,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
//m_log.Info("[PHYSICS]: New Mass: " + newmass.ToString());
|
||||
|
||||
SafeNativeMethods.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z);
|
||||
SafeNativeMethods.BodySetMass(Body, ref pMass);
|
||||
OdeNative.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z);
|
||||
OdeNative.BodySetMass(Body, ref pMass);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -796,7 +796,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
if (Body != (IntPtr)0)
|
||||
{
|
||||
SafeNativeMethods.BodySetAngularVel(Body, x, y, z);
|
||||
OdeNative.BodySetAngularVel(Body, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -818,16 +818,16 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_assetFailed)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
}
|
||||
|
||||
SafeNativeMethods.BodyDestroy(Body);
|
||||
OdeNative.BodyDestroy(Body);
|
||||
lock (childrenPrim)
|
||||
{
|
||||
if (childrenPrim.Count > 0)
|
||||
|
@ -851,14 +851,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_assetFailed)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
}
|
||||
|
||||
Body = IntPtr.Zero;
|
||||
|
@ -915,10 +915,10 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
else
|
||||
{
|
||||
_triMeshData = SafeNativeMethods.GeomTriMeshDataCreate();
|
||||
_triMeshData = OdeNative.GeomTriMeshDataCreate();
|
||||
|
||||
SafeNativeMethods.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
||||
SafeNativeMethods.GeomTriMeshDataPreprocess(_triMeshData);
|
||||
OdeNative.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
|
||||
OdeNative.GeomTriMeshDataPreprocess(_triMeshData);
|
||||
m_MeshToTriMeshMap[mesh] = _triMeshData;
|
||||
}
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||
try
|
||||
{
|
||||
SetGeom(SafeNativeMethods.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null));
|
||||
SetGeom(OdeNative.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null));
|
||||
}
|
||||
catch (AccessViolationException)
|
||||
{
|
||||
|
@ -1032,7 +1032,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
|||
{
|
||||
if (Amotor != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.JointDestroy(Amotor);
|
||||
OdeNative.JointDestroy(Amotor);
|
||||
Amotor = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
@ -1107,7 +1107,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
|||
|
||||
if (Body == IntPtr.Zero)
|
||||
{
|
||||
Body = SafeNativeMethods.BodyCreate(_parent_scene.world);
|
||||
Body = OdeNative.BodyCreate(_parent_scene.world);
|
||||
setMass();
|
||||
}
|
||||
|
||||
|
@ -1123,21 +1123,21 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
|||
|
||||
foreach (OdePrim prm in childrenPrim)
|
||||
{
|
||||
SafeNativeMethods.Mass m2;
|
||||
SafeNativeMethods.MassSetZero(out m2);
|
||||
SafeNativeMethods.MassSetBoxTotal(out m2, prm.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z);
|
||||
OdeNative.Mass m2;
|
||||
OdeNative.MassSetZero(out m2);
|
||||
OdeNative.MassSetBoxTotal(out m2, prm.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z);
|
||||
|
||||
SafeNativeMethods.Quaternion quat = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.Quaternion quat = new OdeNative.Quaternion();
|
||||
quat.W = prm._orientation.W;
|
||||
quat.X = prm._orientation.X;
|
||||
quat.Y = prm._orientation.Y;
|
||||
quat.Z = prm._orientation.Z;
|
||||
|
||||
SafeNativeMethods.Matrix3 mat = new SafeNativeMethods.Matrix3();
|
||||
SafeNativeMethods.RfromQ(out mat, ref quat);
|
||||
SafeNativeMethods.MassRotate(ref m2, ref mat);
|
||||
SafeNativeMethods.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z);
|
||||
SafeNativeMethods.MassAdd(ref pMass, ref m2);
|
||||
OdeNative.Matrix3 mat = new OdeNative.Matrix3();
|
||||
OdeNative.RfromQ(out mat, ref quat);
|
||||
OdeNative.MassRotate(ref m2, ref mat);
|
||||
OdeNative.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z);
|
||||
OdeNative.MassAdd(ref pMass, ref m2);
|
||||
}
|
||||
|
||||
foreach (OdePrim prm in childrenPrim)
|
||||
|
@ -1148,36 +1148,36 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
|||
//Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name);
|
||||
if (prm.m_assetFailed)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0);
|
||||
SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)prm.BadMeshAssetCollideBits);
|
||||
OdeNative.GeomSetCategoryBits(prm.prim_geom, 0);
|
||||
OdeNative.GeomSetCollideBits(prm.prim_geom, (uint)prm.BadMeshAssetCollideBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags);
|
||||
OdeNative.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories);
|
||||
OdeNative.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags);
|
||||
}
|
||||
|
||||
SafeNativeMethods.Quaternion quat = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.Quaternion quat = new OdeNative.Quaternion();
|
||||
quat.W = prm._orientation.W;
|
||||
quat.X = prm._orientation.X;
|
||||
quat.Y = prm._orientation.Y;
|
||||
quat.Z = prm._orientation.Z;
|
||||
|
||||
SafeNativeMethods.Matrix3 mat = new SafeNativeMethods.Matrix3();
|
||||
SafeNativeMethods.RfromQ(out mat, ref quat);
|
||||
OdeNative.Matrix3 mat = new OdeNative.Matrix3();
|
||||
OdeNative.RfromQ(out mat, ref quat);
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.GeomSetBody(prm.prim_geom, Body);
|
||||
OdeNative.GeomSetBody(prm.prim_geom, Body);
|
||||
prm.childPrim = true;
|
||||
SafeNativeMethods.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z);
|
||||
OdeNative.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z);
|
||||
//d.GeomSetOffsetPosition(prim.prim_geom,
|
||||
// (Position.X - prm.Position.X) - pMass.c.X,
|
||||
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
||||
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
||||
SafeNativeMethods.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat);
|
||||
OdeNative.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat);
|
||||
//d.GeomSetOffsetRotation(prm.prim_geom, ref mat);
|
||||
SafeNativeMethods.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
||||
SafeNativeMethods.BodySetMass(Body, ref pMass);
|
||||
OdeNative.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
||||
OdeNative.BodySetMass(Body, ref pMass);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1197,37 +1197,37 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
|||
|
||||
if (m_assetFailed)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name);
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
//Console.WriteLine(" Post GeomSetCategoryBits 2");
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
}
|
||||
|
||||
SafeNativeMethods.Quaternion quat2 = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.Quaternion quat2 = new OdeNative.Quaternion();
|
||||
quat2.W = _orientation.W;
|
||||
quat2.X = _orientation.X;
|
||||
quat2.Y = _orientation.Y;
|
||||
quat2.Z = _orientation.Z;
|
||||
|
||||
SafeNativeMethods.Matrix3 mat2 = new SafeNativeMethods.Matrix3();
|
||||
SafeNativeMethods.RfromQ(out mat2, ref quat2);
|
||||
SafeNativeMethods.GeomSetBody(prim_geom, Body);
|
||||
SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z);
|
||||
OdeNative.Matrix3 mat2 = new OdeNative.Matrix3();
|
||||
OdeNative.RfromQ(out mat2, ref quat2);
|
||||
OdeNative.GeomSetBody(prim_geom, Body);
|
||||
OdeNative.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z);
|
||||
//d.GeomSetOffsetPosition(prim.prim_geom,
|
||||
// (Position.X - prm.Position.X) - pMass.c.X,
|
||||
// (Position.Y - prm.Position.Y) - pMass.c.Y,
|
||||
// (Position.Z - prm.Position.Z) - pMass.c.Z);
|
||||
//d.GeomSetOffsetRotation(prim_geom, ref mat2);
|
||||
SafeNativeMethods.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
||||
SafeNativeMethods.BodySetMass(Body, ref pMass);
|
||||
OdeNative.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
|
||||
OdeNative.BodySetMass(Body, ref pMass);
|
||||
|
||||
SafeNativeMethods.BodySetAutoDisableFlag(Body, true);
|
||||
SafeNativeMethods.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
||||
OdeNative.BodySetAutoDisableFlag(Body, true);
|
||||
OdeNative.BodySetAutoDisableSteps(Body, body_autodisable_frames);
|
||||
|
||||
m_interpenetrationcount = 0;
|
||||
m_collisionscore = 0;
|
||||
|
@ -1240,7 +1240,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
|||
createAMotor(m_angularlock);
|
||||
}
|
||||
|
||||
SafeNativeMethods.BodySetPosition(Body, Position.X, Position.Y, Position.Z);
|
||||
OdeNative.BodySetPosition(Body, Position.X, Position.Y, Position.Z);
|
||||
|
||||
if (m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||
m_vehicle.Enable(Body, _parent_scene);
|
||||
|
@ -1370,13 +1370,13 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
|||
|
||||
if (m_assetFailed)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
}
|
||||
|
||||
if (IsPhysical)
|
||||
|
@ -1400,21 +1400,21 @@ Console.WriteLine("ZProcessTaints for " + Name);
|
|||
|
||||
if (m_assetFailed)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, 0);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
}
|
||||
|
||||
if (IsPhysical)
|
||||
{
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetLinearVel(Body, 0f, 0f, 0f);
|
||||
SafeNativeMethods.BodySetForce(Body, 0, 0, 0);
|
||||
OdeNative.BodySetLinearVel(Body, 0f, 0f, 0f);
|
||||
OdeNative.BodySetForce(Body, 0, 0, 0);
|
||||
enableBodySoft();
|
||||
}
|
||||
}
|
||||
|
@ -1463,7 +1463,7 @@ Console.WriteLine("CreateGeom:");
|
|||
try
|
||||
{
|
||||
//Console.WriteLine(" CreateGeom 1");
|
||||
SetGeom(SafeNativeMethods.CreateSphere(m_targetSpace, _size.X / 2));
|
||||
SetGeom(OdeNative.CreateSphere(m_targetSpace, _size.X / 2));
|
||||
m_expectedCollisionContacts = 3;
|
||||
}
|
||||
catch (AccessViolationException)
|
||||
|
@ -1478,7 +1478,7 @@ Console.WriteLine("CreateGeom:");
|
|||
try
|
||||
{
|
||||
//Console.WriteLine(" CreateGeom 2");
|
||||
SetGeom(SafeNativeMethods.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
|
||||
SetGeom(OdeNative.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
|
||||
m_expectedCollisionContacts = 4;
|
||||
}
|
||||
catch (AccessViolationException)
|
||||
|
@ -1494,7 +1494,7 @@ Console.WriteLine("CreateGeom:");
|
|||
try
|
||||
{
|
||||
//Console.WriteLine(" CreateGeom 3");
|
||||
SetGeom(SafeNativeMethods.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
|
||||
SetGeom(OdeNative.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
|
||||
m_expectedCollisionContacts = 4;
|
||||
}
|
||||
catch (AccessViolationException)
|
||||
|
@ -1510,7 +1510,7 @@ Console.WriteLine("CreateGeom:");
|
|||
try
|
||||
{
|
||||
//Console.WriteLine(" CreateGeom 4");
|
||||
SetGeom(SafeNativeMethods.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
|
||||
SetGeom(OdeNative.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z));
|
||||
m_expectedCollisionContacts = 4;
|
||||
}
|
||||
catch (AccessViolationException)
|
||||
|
@ -1536,7 +1536,7 @@ Console.WriteLine("CreateGeom:");
|
|||
{
|
||||
_parent_scene.geom_name_map.Remove(prim_geom);
|
||||
_parent_scene.actor_name_map.Remove(prim_geom);
|
||||
SafeNativeMethods.GeomDestroy(prim_geom);
|
||||
OdeNative.GeomDestroy(prim_geom);
|
||||
m_expectedCollisionContacts = 0;
|
||||
prim_geom = IntPtr.Zero;
|
||||
}
|
||||
|
@ -1593,13 +1593,13 @@ Console.WriteLine("changeadd 1");
|
|||
#endif
|
||||
CreateGeom(m_targetSpace, mesh);
|
||||
|
||||
SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||
SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||
OdeNative.Quaternion myrot = new OdeNative.Quaternion();
|
||||
myrot.X = _orientation.X;
|
||||
myrot.Y = _orientation.Y;
|
||||
myrot.Z = _orientation.Z;
|
||||
myrot.W = _orientation.W;
|
||||
SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
|
||||
OdeNative.GeomSetQuaternion(prim_geom, ref myrot);
|
||||
|
||||
if (IsPhysical && Body == IntPtr.Zero)
|
||||
enableBody();
|
||||
|
@ -1627,14 +1627,14 @@ Console.WriteLine("changeadd 1");
|
|||
{
|
||||
if (m_linkJoint != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.JointDestroy(m_linkJoint);
|
||||
OdeNative.JointDestroy(m_linkJoint);
|
||||
m_linkJoint = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
OdeNative.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
|
||||
if (_parent != null)
|
||||
{
|
||||
|
@ -1643,12 +1643,12 @@ Console.WriteLine("changeadd 1");
|
|||
{
|
||||
// KF: Fixed Joints were removed? Anyway - this Console.WriteLine does not show up, so routine is not used??
|
||||
Console.WriteLine(" JointCreateFixed");
|
||||
m_linkJoint = SafeNativeMethods.JointCreateFixed(_parent_scene.world, _linkJointGroup);
|
||||
SafeNativeMethods.JointAttach(m_linkJoint, Body, odParent.Body);
|
||||
SafeNativeMethods.JointSetFixed(m_linkJoint);
|
||||
m_linkJoint = OdeNative.JointCreateFixed(_parent_scene.world, _linkJointGroup);
|
||||
OdeNative.JointAttach(m_linkJoint, Body, odParent.Body);
|
||||
OdeNative.JointSetFixed(m_linkJoint);
|
||||
}
|
||||
}
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
OdeNative.BodyEnable(Body);
|
||||
if (m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||
{
|
||||
m_vehicle.Enable(Body, _parent_scene);
|
||||
|
@ -1674,10 +1674,10 @@ Console.WriteLine(" JointCreateFixed");
|
|||
|
||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||
|
||||
SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||
OdeNative.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||
|
||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||
SafeNativeMethods.SpaceAdd(m_targetSpace, prim_geom);
|
||||
OdeNative.SpaceAdd(m_targetSpace, prim_geom);
|
||||
|
||||
changeSelectedStatus();
|
||||
|
||||
|
@ -1704,7 +1704,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
else
|
||||
{
|
||||
//Console.WriteLine("Move " + Name);
|
||||
if (!SafeNativeMethods.BodyIsEnabled (Body)) SafeNativeMethods.BodyEnable (Body); // KF add 161009
|
||||
if (!OdeNative.BodyIsEnabled (Body)) OdeNative.BodyEnable (Body); // KF add 161009
|
||||
|
||||
float m_mass = CalculateMass();
|
||||
|
||||
|
@ -1746,9 +1746,9 @@ Console.WriteLine(" JointCreateFixed");
|
|||
//PidStatus = true;
|
||||
|
||||
// PhysicsVector vec = new PhysicsVector();
|
||||
SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body);
|
||||
OdeNative.Vector3 vel = OdeNative.BodyGetLinearVel(Body);
|
||||
|
||||
SafeNativeMethods.Vector3 pos = SafeNativeMethods.BodyGetPosition(Body);
|
||||
OdeNative.Vector3 pos = OdeNative.BodyGetPosition(Body);
|
||||
_target_velocity =
|
||||
new Vector3(
|
||||
(m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
|
||||
|
@ -1770,9 +1770,9 @@ Console.WriteLine(" JointCreateFixed");
|
|||
//fx = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2);
|
||||
//fy = (_target_velocity.Y - vel.Y) * (PID_D) + (_zeroPosition.Y - pos.Y) * (PID_P * 2);
|
||||
//fz = fz + (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P;
|
||||
SafeNativeMethods.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z);
|
||||
SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0);
|
||||
SafeNativeMethods.BodyAddForce(Body, 0, 0, fz);
|
||||
OdeNative.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z);
|
||||
OdeNative.BodySetLinearVel(Body, 0, 0, 0);
|
||||
OdeNative.BodyAddForce(Body, 0, 0, fz);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -1813,8 +1813,8 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
|
||||
// Where are we, and where are we headed?
|
||||
SafeNativeMethods.Vector3 pos = SafeNativeMethods.BodyGetPosition(Body);
|
||||
SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body);
|
||||
OdeNative.Vector3 pos = OdeNative.BodyGetPosition(Body);
|
||||
OdeNative.Vector3 vel = OdeNative.BodyGetLinearVel(Body);
|
||||
|
||||
// Non-Vehicles have a limited set of Hover options.
|
||||
// determine what our target height really is based on HoverType
|
||||
|
@ -1856,9 +1856,9 @@ Console.WriteLine(" JointCreateFixed");
|
|||
// Avatar to Avatar collisions
|
||||
// Prim to avatar collisions
|
||||
|
||||
SafeNativeMethods.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight);
|
||||
SafeNativeMethods.BodySetLinearVel(Body, vel.X, vel.Y, 0);
|
||||
SafeNativeMethods.BodyAddForce(Body, 0, 0, fz);
|
||||
OdeNative.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight);
|
||||
OdeNative.BodySetLinearVel(Body, vel.X, vel.Y, 0);
|
||||
OdeNative.BodyAddForce(Body, 0, 0, fz);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -1884,13 +1884,13 @@ Console.WriteLine(" JointCreateFixed");
|
|||
//m_taintdisable = true;
|
||||
//base.RaiseOutOfBounds(Position);
|
||||
//d.BodySetLinearVel(Body, fx, fy, 0f);
|
||||
if (!SafeNativeMethods.BodyIsEnabled(Body))
|
||||
if (!OdeNative.BodyIsEnabled(Body))
|
||||
{
|
||||
// A physical body at rest on a surface will auto-disable after a while,
|
||||
// this appears to re-enable it incase the surface it is upon vanishes,
|
||||
// and the body should fall again.
|
||||
SafeNativeMethods.BodySetLinearVel(Body, 0f, 0f, 0f);
|
||||
SafeNativeMethods.BodySetForce(Body, 0, 0, 0);
|
||||
OdeNative.BodySetLinearVel(Body, 0f, 0f, 0f);
|
||||
OdeNative.BodySetForce(Body, 0, 0, 0);
|
||||
enableBodySoft();
|
||||
}
|
||||
|
||||
|
@ -1906,7 +1906,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
fy = nmax;
|
||||
if (fy < nmin)
|
||||
fy = nmin;
|
||||
SafeNativeMethods.BodyAddForce(Body, fx, fy, fz);
|
||||
OdeNative.BodyAddForce(Body, fx, fy, fz);
|
||||
//Console.WriteLine("AddForce " + fx + "," + fy + "," + fz);
|
||||
}
|
||||
}
|
||||
|
@ -1922,7 +1922,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
|
||||
private void rotate()
|
||||
{
|
||||
SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.Quaternion myrot = new OdeNative.Quaternion();
|
||||
myrot.X = _orientation.X;
|
||||
myrot.Y = _orientation.Y;
|
||||
myrot.Z = _orientation.Z;
|
||||
|
@ -1930,7 +1930,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
// KF: If this is a root prim do BodySet
|
||||
SafeNativeMethods.BodySetQuaternion(Body, ref myrot);
|
||||
OdeNative.BodySetQuaternion(Body, ref myrot);
|
||||
if (IsPhysical)
|
||||
{
|
||||
// create or remove locks
|
||||
|
@ -1940,7 +1940,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
else
|
||||
{
|
||||
// daughter prim, do Geom set
|
||||
SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
|
||||
OdeNative.GeomSetQuaternion(prim_geom, ref myrot);
|
||||
}
|
||||
|
||||
resetCollisionAccounting();
|
||||
|
@ -1962,7 +1962,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
m_disabled = true;
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodyDisable(Body);
|
||||
OdeNative.BodyDisable(Body);
|
||||
Body = IntPtr.Zero;
|
||||
}
|
||||
|
||||
|
@ -2051,10 +2051,10 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
}
|
||||
|
||||
if (SafeNativeMethods.SpaceQuery(m_targetSpace, prim_geom))
|
||||
if (OdeNative.SpaceQuery(m_targetSpace, prim_geom))
|
||||
{
|
||||
// _parent_scene.waitForSpaceUnlock(m_targetSpace);
|
||||
SafeNativeMethods.SpaceRemove(m_targetSpace, prim_geom);
|
||||
OdeNative.SpaceRemove(m_targetSpace, prim_geom);
|
||||
}
|
||||
|
||||
RemoveGeom();
|
||||
|
@ -2084,13 +2084,13 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
|
||||
CreateGeom(m_targetSpace, mesh);
|
||||
SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||
SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||
OdeNative.Quaternion myrot = new OdeNative.Quaternion();
|
||||
myrot.X = _orientation.X;
|
||||
myrot.Y = _orientation.Y;
|
||||
myrot.Z = _orientation.Z;
|
||||
myrot.W = _orientation.W;
|
||||
SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
|
||||
OdeNative.GeomSetQuaternion(prim_geom, ref myrot);
|
||||
|
||||
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
|
||||
if (IsPhysical && Body == IntPtr.Zero && !childPrim)
|
||||
|
@ -2098,7 +2098,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
// Re creates body on size.
|
||||
// EnableBody also does setMass()
|
||||
enableBody();
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
OdeNative.BodyEnable(Body);
|
||||
}
|
||||
|
||||
changeSelectedStatus();
|
||||
|
@ -2133,10 +2133,10 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
|
||||
if (m_assetFailed)
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits);
|
||||
else
|
||||
|
||||
SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
OdeNative.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
|
||||
}
|
||||
/// <summary>
|
||||
/// Change prim in response to a shape taint.
|
||||
|
@ -2190,14 +2190,14 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
|
||||
CreateGeom(m_targetSpace, mesh);
|
||||
SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||
SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
|
||||
OdeNative.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
|
||||
OdeNative.Quaternion myrot = new OdeNative.Quaternion();
|
||||
//myrot.W = _orientation.w;
|
||||
myrot.W = _orientation.W;
|
||||
myrot.X = _orientation.X;
|
||||
myrot.Y = _orientation.Y;
|
||||
myrot.Z = _orientation.Z;
|
||||
SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
|
||||
OdeNative.GeomSetQuaternion(prim_geom, ref myrot);
|
||||
|
||||
//d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
|
||||
if (IsPhysical && Body == IntPtr.Zero)
|
||||
|
@ -2207,7 +2207,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
enableBody();
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
OdeNative.BodyEnable(Body);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2264,8 +2264,8 @@ Console.WriteLine(" JointCreateFixed");
|
|||
m_taintforce = false;
|
||||
return;
|
||||
}
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
SafeNativeMethods.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z);
|
||||
OdeNative.BodyEnable(Body);
|
||||
OdeNative.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z);
|
||||
}
|
||||
m_forcelist.Clear();
|
||||
}
|
||||
|
@ -2286,7 +2286,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
{
|
||||
if (IsPhysical && Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z);
|
||||
OdeNative.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2310,8 +2310,8 @@ Console.WriteLine(" JointCreateFixed");
|
|||
{
|
||||
iforce = iforce + (m_angularforcelist[i] * 100);
|
||||
}
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
SafeNativeMethods.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z);
|
||||
OdeNative.BodyEnable(Body);
|
||||
OdeNative.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z);
|
||||
|
||||
}
|
||||
m_angularforcelist.Clear();
|
||||
|
@ -2339,7 +2339,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
{
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
|
||||
OdeNative.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2667,7 +2667,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
*/
|
||||
|
||||
SafeNativeMethods.AllocateODEDataForThread(0);
|
||||
OdeNative.AllocateODEDataForThread(0);
|
||||
|
||||
_position.X = Utils.Clamp(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f);
|
||||
_position.Y = Utils.Clamp(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f);
|
||||
|
@ -2682,8 +2682,8 @@ Console.WriteLine(" JointCreateFixed");
|
|||
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it
|
||||
SafeNativeMethods.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
OdeNative.BodySetLinearVel(Body, 0, 0, 0); // stop it
|
||||
OdeNative.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
}
|
||||
|
||||
if(m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
|
||||
|
@ -2730,11 +2730,11 @@ Console.WriteLine(" JointCreateFixed");
|
|||
float m_minvelocity = 0;
|
||||
if (Body != IntPtr.Zero) // FIXME -> or if it is a joint
|
||||
{
|
||||
SafeNativeMethods.Vector3 vec = SafeNativeMethods.BodyGetPosition(Body);
|
||||
SafeNativeMethods.Quaternion ori = SafeNativeMethods.BodyGetQuaternion(Body);
|
||||
SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body);
|
||||
SafeNativeMethods.Vector3 rotvel = SafeNativeMethods.BodyGetAngularVel(Body);
|
||||
SafeNativeMethods.Vector3 torque = SafeNativeMethods.BodyGetTorque(Body);
|
||||
OdeNative.Vector3 vec = OdeNative.BodyGetPosition(Body);
|
||||
OdeNative.Quaternion ori = OdeNative.BodyGetQuaternion(Body);
|
||||
OdeNative.Vector3 vel = OdeNative.BodyGetLinearVel(Body);
|
||||
OdeNative.Vector3 rotvel = OdeNative.BodyGetAngularVel(Body);
|
||||
OdeNative.Vector3 torque = OdeNative.BodyGetTorque(Body);
|
||||
_torque = new Vector3(torque.X, torque.Y, torque.Z);
|
||||
Vector3 l_position = Vector3.Zero;
|
||||
Quaternion l_orientation = Quaternion.Identity;
|
||||
|
@ -2814,11 +2814,11 @@ Console.WriteLine(" JointCreateFixed");
|
|||
else
|
||||
Util.Clamp(l_position.Y, _parent_scene.WorldExtents.Y + 0.1f, _parent_scene.WorldExtents.Y + 2f);
|
||||
|
||||
SafeNativeMethods.BodySetPosition(Body, l_position.X, l_position.Y, l_position.Z);
|
||||
OdeNative.BodySetPosition(Body, l_position.X, l_position.Y, l_position.Z);
|
||||
|
||||
// stop it
|
||||
SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0);
|
||||
SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0);
|
||||
OdeNative.BodySetAngularVel(Body, 0, 0, 0);
|
||||
OdeNative.BodySetLinearVel(Body, 0, 0, 0);
|
||||
disableBodySoft();
|
||||
|
||||
_position = l_position;
|
||||
|
@ -3011,7 +3011,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
|
||||
if (Amotor != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.JointDestroy(Amotor);
|
||||
OdeNative.JointDestroy(Amotor);
|
||||
Amotor = IntPtr.Zero;
|
||||
}
|
||||
|
||||
|
@ -3041,19 +3041,19 @@ Console.WriteLine(" JointCreateFixed");
|
|||
if(axisnum == 0)
|
||||
return;
|
||||
// stop it
|
||||
SafeNativeMethods.BodySetTorque(Body, 0, 0, 0);
|
||||
SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0);
|
||||
OdeNative.BodySetTorque(Body, 0, 0, 0);
|
||||
OdeNative.BodySetAngularVel(Body, 0, 0, 0);
|
||||
|
||||
Amotor = SafeNativeMethods.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
|
||||
SafeNativeMethods.JointAttach(Amotor, Body, IntPtr.Zero);
|
||||
Amotor = OdeNative.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
|
||||
OdeNative.JointAttach(Amotor, Body, IntPtr.Zero);
|
||||
|
||||
SafeNativeMethods.JointSetAMotorMode(Amotor, 0);
|
||||
OdeNative.JointSetAMotorMode(Amotor, 0);
|
||||
|
||||
SafeNativeMethods.JointSetAMotorNumAxes(Amotor, axisnum);
|
||||
OdeNative.JointSetAMotorNumAxes(Amotor, axisnum);
|
||||
|
||||
// get current orientation to lock
|
||||
|
||||
SafeNativeMethods.Quaternion dcur = SafeNativeMethods.BodyGetQuaternion(Body);
|
||||
OdeNative.Quaternion dcur = OdeNative.BodyGetQuaternion(Body);
|
||||
Quaternion curr; // crap convertion between identical things
|
||||
curr.X = dcur.X;
|
||||
curr.Y = dcur.Y;
|
||||
|
@ -3066,17 +3066,17 @@ Console.WriteLine(" JointCreateFixed");
|
|||
if (axisX)
|
||||
{
|
||||
ax = (new Vector3(1, 0, 0)) * curr; // rotate world X to current local X
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, 0, 0, ax.X, ax.Y, ax.Z);
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, 0, 0);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.LoStop, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.HiStop, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel, 0);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Bounce, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.CFM, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.FMax, 5e8f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.StopCFM, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.StopERP, 0.8f);
|
||||
OdeNative.JointSetAMotorAxis(Amotor, 0, 0, ax.X, ax.Y, ax.Z);
|
||||
OdeNative.JointSetAMotorAngle(Amotor, 0, 0);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.LoStop, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.HiStop, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.Vel, 0);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.FudgeFactor, 0.0001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.Bounce, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.CFM, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.FMax, 5e8f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.StopCFM, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, (int)OdeNative.JointParam.StopERP, 0.8f);
|
||||
i++;
|
||||
j = 256; // move to next axis set
|
||||
}
|
||||
|
@ -3084,17 +3084,17 @@ Console.WriteLine(" JointCreateFixed");
|
|||
if (axisY)
|
||||
{
|
||||
ax = (new Vector3(0, 1, 0)) * curr;
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z);
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, i, 0);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.LoStop, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.HiStop, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Vel, 0);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Bounce, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.CFM, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FMax, 5e8f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopCFM, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopERP, 0.8f);
|
||||
OdeNative.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z);
|
||||
OdeNative.JointSetAMotorAngle(Amotor, i, 0);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.LoStop, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.HiStop, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.Vel, 0);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.FudgeFactor, 0.0001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.Bounce, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.CFM, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.FMax, 5e8f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.StopCFM, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.StopERP, 0.8f);
|
||||
i++;
|
||||
j += 256;
|
||||
}
|
||||
|
@ -3102,17 +3102,17 @@ Console.WriteLine(" JointCreateFixed");
|
|||
if (axisZ)
|
||||
{
|
||||
ax = (new Vector3(0, 0, 1)) * curr;
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z);
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, i, 0);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.LoStop, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.HiStop, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Vel, 0);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Bounce, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.CFM, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FMax, 5e8f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopCFM, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopERP, 0.8f);
|
||||
OdeNative.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z);
|
||||
OdeNative.JointSetAMotorAngle(Amotor, i, 0);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.LoStop, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.HiStop, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.Vel, 0);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.FudgeFactor, 0.0001f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.Bounce, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.CFM, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.FMax, 5e8f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.StopCFM, 0f);
|
||||
OdeNative.JointSetAMotorParam(Amotor, j + (int)OdeNative.JointParam.StopERP, 0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,12 +61,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
/// <summary>
|
||||
/// ODE contact array to be filled by the collision testing
|
||||
/// </summary>
|
||||
SafeNativeMethods.ContactGeom[] contacts = new SafeNativeMethods.ContactGeom[5];
|
||||
OdeNative.ContactGeom[] contacts = new OdeNative.ContactGeom[5];
|
||||
|
||||
/// <summary>
|
||||
/// ODE near callback delegate
|
||||
/// </summary>
|
||||
private SafeNativeMethods.NearCallback nearCallback;
|
||||
private OdeNative.NearCallback nearCallback;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private List<ContactResult> m_contactResults = new List<ContactResult>();
|
||||
|
||||
|
@ -179,14 +179,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
len = 100f;
|
||||
|
||||
// Create the ray
|
||||
IntPtr ray = SafeNativeMethods.CreateRay(m_scene.space, len);
|
||||
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
|
||||
IntPtr ray = OdeNative.CreateRay(m_scene.space, len);
|
||||
OdeNative.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
|
||||
|
||||
// Collide test
|
||||
SafeNativeMethods.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
|
||||
OdeNative.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
|
||||
|
||||
// Remove Ray
|
||||
SafeNativeMethods.GeomDestroy(ray);
|
||||
OdeNative.GeomDestroy(ray);
|
||||
|
||||
// Define default results
|
||||
bool hitYN = false;
|
||||
|
@ -230,14 +230,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
len = 100f;
|
||||
|
||||
// Create the ray
|
||||
IntPtr ray = SafeNativeMethods.CreateRay(m_scene.space, len);
|
||||
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
|
||||
IntPtr ray = OdeNative.CreateRay(m_scene.space, len);
|
||||
OdeNative.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
|
||||
|
||||
// Collide test
|
||||
SafeNativeMethods.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
|
||||
OdeNative.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
|
||||
|
||||
// Remove Ray
|
||||
SafeNativeMethods.GeomDestroy(ray);
|
||||
OdeNative.GeomDestroy(ray);
|
||||
|
||||
// Find closest contact and object.
|
||||
lock (m_contactResults)
|
||||
|
@ -258,7 +258,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// return;
|
||||
|
||||
// Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms.
|
||||
if (SafeNativeMethods.GeomIsSpace(g1) || SafeNativeMethods.GeomIsSpace(g2))
|
||||
if (OdeNative.GeomIsSpace(g1) || OdeNative.GeomIsSpace(g2))
|
||||
{
|
||||
if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
|
||||
return;
|
||||
|
@ -269,7 +269,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// contact points in the space
|
||||
try
|
||||
{
|
||||
SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
|
||||
OdeNative.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
|
||||
}
|
||||
catch (AccessViolationException)
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
lock (contacts)
|
||||
{
|
||||
count = SafeNativeMethods.Collide(g1, g2, contacts.GetLength(0), contacts, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
|
||||
count = OdeNative.Collide(g1, g2, contacts.GetLength(0), contacts, OdeNative.ContactGeom.unmanagedSizeOf);
|
||||
}
|
||||
}
|
||||
catch (SEHException)
|
||||
|
|
|
@ -336,7 +336,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
private bool m_filterCollisions = true;
|
||||
|
||||
private SafeNativeMethods.NearCallback nearCallback;
|
||||
private OdeNative.NearCallback nearCallback;
|
||||
|
||||
/// <summary>
|
||||
/// Avatars in the physics scene.
|
||||
|
@ -366,7 +366,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
/// <summary>
|
||||
/// Keep record of contacts in the physics loop so that we can remove duplicates.
|
||||
/// </summary>
|
||||
private readonly List<SafeNativeMethods.ContactGeom> _perloopContact = new List<SafeNativeMethods.ContactGeom>();
|
||||
private readonly List<OdeNative.ContactGeom> _perloopContact = new List<OdeNative.ContactGeom>();
|
||||
|
||||
/// <summary>
|
||||
/// A dictionary of actors that should receive collision events.
|
||||
|
@ -404,17 +404,17 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
/// </remarks>
|
||||
private readonly List<OdeCharacter> defects = new List<OdeCharacter>();
|
||||
|
||||
private SafeNativeMethods.ContactGeom[] contacts;
|
||||
private OdeNative.ContactGeom[] contacts;
|
||||
|
||||
private readonly DoubleDictionary<Vector3, IntPtr, IntPtr> RegionTerrain = new DoubleDictionary<Vector3, IntPtr, IntPtr>();
|
||||
private readonly Dictionary<IntPtr,float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
|
||||
|
||||
private SafeNativeMethods.Contact contact;
|
||||
private SafeNativeMethods.Contact TerrainContact;
|
||||
private SafeNativeMethods.Contact AvatarMovementprimContact;
|
||||
private SafeNativeMethods.Contact AvatarMovementTerrainContact;
|
||||
private SafeNativeMethods.Contact WaterContact;
|
||||
private SafeNativeMethods.Contact[,] m_materialContacts;
|
||||
private OdeNative.Contact contact;
|
||||
private OdeNative.Contact TerrainContact;
|
||||
private OdeNative.Contact AvatarMovementprimContact;
|
||||
private OdeNative.Contact AvatarMovementTerrainContact;
|
||||
private OdeNative.Contact WaterContact;
|
||||
private OdeNative.Contact[,] m_materialContacts;
|
||||
|
||||
private int m_physicsiterations = 10;
|
||||
private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
|
||||
|
@ -452,8 +452,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
private bool avplanted = false;
|
||||
private bool av_av_collisions_off = false;
|
||||
|
||||
internal SafeNativeMethods.Vector3 xyz = new SafeNativeMethods.Vector3(128.1640f, 128.3079f, 25.7600f);
|
||||
internal SafeNativeMethods.Vector3 hpr = new SafeNativeMethods.Vector3(125.5000f, -17.0000f, 0.0000f);
|
||||
internal OdeNative.Vector3 xyz = new OdeNative.Vector3(128.1640f, 128.3079f, 25.7600f);
|
||||
internal OdeNative.Vector3 hpr = new OdeNative.Vector3(125.5000f, -17.0000f, 0.0000f);
|
||||
|
||||
private volatile int m_global_contactcount = 0;
|
||||
|
||||
|
@ -472,7 +472,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
public OdeScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion)
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
OdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
m_config = psourceconfig;
|
||||
m_frameWorkScene = pscene;
|
||||
|
@ -518,11 +518,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
m_rayCastManager = new ODERayCastRequestManager(this);
|
||||
|
||||
// Create the world and the first space
|
||||
world = SafeNativeMethods.WorldCreate();
|
||||
space = SafeNativeMethods.HashSpaceCreate(IntPtr.Zero);
|
||||
contactgroup = SafeNativeMethods.JointGroupCreate(0);
|
||||
world = OdeNative.WorldCreate();
|
||||
space = OdeNative.HashSpaceCreate(IntPtr.Zero);
|
||||
contactgroup = OdeNative.JointGroupCreate(0);
|
||||
|
||||
SafeNativeMethods.WorldSetAutoDisableFlag(world, false);
|
||||
OdeNative.WorldSetAutoDisableFlag(world, false);
|
||||
}
|
||||
|
||||
// Initialize from configs
|
||||
|
@ -623,7 +623,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
}
|
||||
|
||||
contacts = new SafeNativeMethods.ContactGeom[contactsPerCollision];
|
||||
contacts = new OdeNative.ContactGeom[contactsPerCollision];
|
||||
|
||||
spacesPerMeterX = 1.0f / metersInSpace;
|
||||
spacesPerMeterY = 1.0f / metersInSpace;
|
||||
|
@ -652,7 +652,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// Centeral contact friction and bounce
|
||||
// ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why
|
||||
// an avatar falls through in Z but not in X or Y when walking on a prim.
|
||||
contact.surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
contact.surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
contact.surface.mu = nmAvatarObjectContactFriction;
|
||||
contact.surface.bounce = nmAvatarObjectContactBounce;
|
||||
contact.surface.soft_cfm = 0.010f;
|
||||
|
@ -661,12 +661,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// Terrain contact friction and Bounce
|
||||
// This is the *non* moving version. Use this when an avatar
|
||||
// isn't moving to keep it in place better
|
||||
TerrainContact.surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
TerrainContact.surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
TerrainContact.surface.mu = nmTerrainContactFriction;
|
||||
TerrainContact.surface.bounce = nmTerrainContactBounce;
|
||||
TerrainContact.surface.soft_erp = nmTerrainContactERP;
|
||||
|
||||
WaterContact.surface.mode |= (SafeNativeMethods.ContactFlags.SoftERP | SafeNativeMethods.ContactFlags.SoftCFM);
|
||||
WaterContact.surface.mode |= (OdeNative.ContactFlags.SoftERP | OdeNative.ContactFlags.SoftCFM);
|
||||
WaterContact.surface.mu = 0f; // No friction
|
||||
WaterContact.surface.bounce = 0.0f; // No bounce
|
||||
WaterContact.surface.soft_cfm = 0.010f;
|
||||
|
@ -681,7 +681,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
// Terrain contact friction bounce and various error correcting calculations
|
||||
// Use this when an avatar is in contact with the terrain and moving.
|
||||
AvatarMovementTerrainContact.surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
AvatarMovementTerrainContact.surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
AvatarMovementTerrainContact.surface.mu = mTerrainContactFriction;
|
||||
AvatarMovementTerrainContact.surface.bounce = mTerrainContactBounce;
|
||||
AvatarMovementTerrainContact.surface.soft_erp = mTerrainContactERP;
|
||||
|
@ -703,38 +703,38 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
Rubber = 6
|
||||
*/
|
||||
|
||||
m_materialContacts = new SafeNativeMethods.Contact[7,2];
|
||||
m_materialContacts = new OdeNative.Contact[7,2];
|
||||
|
||||
m_materialContacts[(int)Material.Stone, 0] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Stone, 0].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Stone, 0] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Stone, 0].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Stone, 0].surface.mu = nmAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Stone, 0].surface.bounce = nmAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Stone, 0].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Stone, 0].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Stone, 1] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Stone, 1].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Stone, 1] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Stone, 1].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Stone, 1].surface.mu = mAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Stone, 1].surface.bounce = mAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Stone, 1].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Stone, 1].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Metal, 0] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Metal, 0].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Metal, 0] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Metal, 0].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Metal, 0].surface.mu = nmAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Metal, 0].surface.bounce = nmAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Metal, 0].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Metal, 0].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Metal, 1] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Metal, 1].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Metal, 1] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Metal, 1].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Metal, 1].surface.mu = mAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Metal, 1].surface.bounce = mAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Metal, 1].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Metal, 1].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Glass, 0] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Glass, 0].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Glass, 0] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Glass, 0].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Glass, 0].surface.mu = 1f;
|
||||
m_materialContacts[(int)Material.Glass, 0].surface.bounce = 0.5f;
|
||||
m_materialContacts[(int)Material.Glass, 0].surface.soft_cfm = 0.010f;
|
||||
|
@ -747,83 +747,83 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
private float mAvatarObjectContactFriction = 75f;
|
||||
private float mAvatarObjectContactBounce = 0.1f;
|
||||
*/
|
||||
m_materialContacts[(int)Material.Glass, 1] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Glass, 1].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Glass, 1] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Glass, 1].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Glass, 1].surface.mu = 1f;
|
||||
m_materialContacts[(int)Material.Glass, 1].surface.bounce = 0.5f;
|
||||
m_materialContacts[(int)Material.Glass, 1].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Glass, 1].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Wood, 0] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Wood, 0].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Wood, 0] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Wood, 0].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Wood, 0].surface.mu = nmAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Wood, 0].surface.bounce = nmAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Wood, 0].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Wood, 0].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Wood, 1] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Wood, 1].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Wood, 1] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Wood, 1].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Wood, 1].surface.mu = mAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Wood, 1].surface.bounce = mAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Wood, 1].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Wood, 1].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Flesh, 0] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Flesh, 0].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Flesh, 0] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Flesh, 0].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Flesh, 0].surface.mu = nmAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Flesh, 0].surface.bounce = nmAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Flesh, 0].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Flesh, 0].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Flesh, 1] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Flesh, 1].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Flesh, 1] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Flesh, 1].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Flesh, 1].surface.mu = mAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Flesh, 1].surface.bounce = mAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Flesh, 1].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Flesh, 1].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Plastic, 0] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Plastic, 0].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Plastic, 0] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Plastic, 0].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Plastic, 0].surface.mu = nmAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Plastic, 0].surface.bounce = nmAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Plastic, 0].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Plastic, 0].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Plastic, 1] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Plastic, 1].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Plastic, 1] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Plastic, 1].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Plastic, 1].surface.mu = mAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Plastic, 1].surface.bounce = mAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Plastic, 1].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Plastic, 1].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Rubber, 0] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Rubber, 0].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Rubber, 0] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Rubber, 0].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Rubber, 0].surface.mu = nmAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Rubber, 0].surface.bounce = nmAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Rubber, 0].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Rubber, 0].surface.soft_erp = 0.010f;
|
||||
|
||||
m_materialContacts[(int)Material.Rubber, 1] = new SafeNativeMethods.Contact();
|
||||
m_materialContacts[(int)Material.Rubber, 1].surface.mode |= SafeNativeMethods.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Rubber, 1] = new OdeNative.Contact();
|
||||
m_materialContacts[(int)Material.Rubber, 1].surface.mode |= OdeNative.ContactFlags.SoftERP;
|
||||
m_materialContacts[(int)Material.Rubber, 1].surface.mu = mAvatarObjectContactFriction;
|
||||
m_materialContacts[(int)Material.Rubber, 1].surface.bounce = mAvatarObjectContactBounce;
|
||||
m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.010f;
|
||||
m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.010f;
|
||||
|
||||
SafeNativeMethods.HashSpaceSetLevels(space, HashspaceLow, HashspaceHigh);
|
||||
OdeNative.HashSpaceSetLevels(space, HashspaceLow, HashspaceHigh);
|
||||
|
||||
// Set the gravity,, don't disable things automatically (we set it explicitly on some things)
|
||||
|
||||
SafeNativeMethods.WorldSetGravity(world, gravityx, gravityy, gravityz);
|
||||
SafeNativeMethods.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
|
||||
OdeNative.WorldSetGravity(world, gravityx, gravityy, gravityz);
|
||||
OdeNative.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
|
||||
|
||||
SafeNativeMethods.WorldSetLinearDamping(world, 256f);
|
||||
SafeNativeMethods.WorldSetAngularDamping(world, 256f);
|
||||
SafeNativeMethods.WorldSetAngularDampingThreshold(world, 256f);
|
||||
SafeNativeMethods.WorldSetLinearDampingThreshold(world, 256f);
|
||||
SafeNativeMethods.WorldSetMaxAngularSpeed(world, 256f);
|
||||
OdeNative.WorldSetLinearDamping(world, 256f);
|
||||
OdeNative.WorldSetAngularDamping(world, 256f);
|
||||
OdeNative.WorldSetAngularDampingThreshold(world, 256f);
|
||||
OdeNative.WorldSetLinearDampingThreshold(world, 256f);
|
||||
OdeNative.WorldSetMaxAngularSpeed(world, 256f);
|
||||
|
||||
SafeNativeMethods.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
||||
OdeNative.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
||||
//d.WorldSetContactMaxCorrectingVel(world, 1000.0f);
|
||||
|
||||
for (int i = 0; i < staticPrimspace.GetLength(0); i++)
|
||||
|
@ -849,7 +849,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
/// <param name='contactsArray'></param>
|
||||
/// <param name='contactGeomSize'></param>
|
||||
private int CollideGeoms(
|
||||
IntPtr geom1, IntPtr geom2, int maxContacts, SafeNativeMethods.ContactGeom[] contactsArray, int contactGeomSize)
|
||||
IntPtr geom1, IntPtr geom2, int maxContacts, OdeNative.ContactGeom[] contactsArray, int contactGeomSize)
|
||||
{
|
||||
int count;
|
||||
|
||||
|
@ -859,7 +859,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (CollectStats)
|
||||
m_nativeCollisionStartTick = Util.EnvironmentTickCount();
|
||||
|
||||
count = SafeNativeMethods.Collide(geom1, geom2, maxContacts, contactsArray, contactGeomSize);
|
||||
count = OdeNative.Collide(geom1, geom2, maxContacts, contactsArray, contactGeomSize);
|
||||
}
|
||||
|
||||
// We do this outside the lock so that any waiting threads aren't held up, though the effect is probably
|
||||
|
@ -885,7 +885,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
m_nativeCollisionStartTick = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
SafeNativeMethods.SpaceCollide2(space1, space2, data, nearCallback);
|
||||
OdeNative.SpaceCollide2(space1, space2, data, nearCallback);
|
||||
|
||||
if (CollectStats && m_inCollisionTiming)
|
||||
{
|
||||
|
@ -916,7 +916,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// Test if we're colliding a geom with a space.
|
||||
// If so we have to drill down into the space recursively
|
||||
|
||||
if (SafeNativeMethods.GeomIsSpace(g1) || SafeNativeMethods.GeomIsSpace(g2))
|
||||
if (OdeNative.GeomIsSpace(g1) || OdeNative.GeomIsSpace(g2))
|
||||
{
|
||||
if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
|
||||
return;
|
||||
|
@ -945,8 +945,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
IntPtr b1 = SafeNativeMethods.GeomGetBody(g1);
|
||||
IntPtr b2 = SafeNativeMethods.GeomGetBody(g2);
|
||||
IntPtr b1 = OdeNative.GeomGetBody(g1);
|
||||
IntPtr b2 = OdeNative.GeomGetBody(g2);
|
||||
|
||||
// d.GeomClassID id = d.GeomGetClass(g1);
|
||||
|
||||
|
@ -973,10 +973,10 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (g1 == g2)
|
||||
return; // Can't collide with yourself
|
||||
|
||||
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && SafeNativeMethods.AreConnectedExcluding(b1, b2, SafeNativeMethods.JointType.Contact))
|
||||
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && OdeNative.AreConnectedExcluding(b1, b2, OdeNative.JointType.Contact))
|
||||
return;
|
||||
|
||||
count = CollideGeoms(g1, g2, contacts.Length, contacts, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
|
||||
count = CollideGeoms(g1, g2, contacts.Length, contacts, OdeNative.ContactGeom.unmanagedSizeOf);
|
||||
|
||||
// All code after this is only relevant if we have any collisions
|
||||
if (count <= 0)
|
||||
|
@ -1024,7 +1024,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
SafeNativeMethods.ContactGeom curContact = contacts[i];
|
||||
OdeNative.ContactGeom curContact = contacts[i];
|
||||
|
||||
if (curContact.depth > maxDepthContact.PenetrationDepth)
|
||||
{
|
||||
|
@ -1101,7 +1101,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
curContact.depth = 0.00000003f;
|
||||
p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f);
|
||||
curContact.pos =
|
||||
new SafeNativeMethods.Vector3(curContact.pos.X + (p1.Size.X/2),
|
||||
new OdeNative.Vector3(curContact.pos.X + (p1.Size.X/2),
|
||||
curContact.pos.Y + (p1.Size.Y/2),
|
||||
curContact.pos.Z + (p1.Size.Z/2));
|
||||
character.SetPidStatus(true);
|
||||
|
@ -1118,7 +1118,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
curContact.depth = 0.00000003f;
|
||||
p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f);
|
||||
curContact.pos =
|
||||
new SafeNativeMethods.Vector3(curContact.pos.X + (p1.Size.X/2),
|
||||
new OdeNative.Vector3(curContact.pos.X + (p1.Size.X/2),
|
||||
curContact.pos.Y + (p1.Size.Y/2),
|
||||
curContact.pos.Z + (p1.Size.Z/2));
|
||||
character.SetPidStatus(true);
|
||||
|
@ -1170,7 +1170,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath)
|
||||
{
|
||||
joint = SafeNativeMethods.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact);
|
||||
joint = OdeNative.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
}
|
||||
|
@ -1184,7 +1184,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath)
|
||||
{
|
||||
joint = SafeNativeMethods.JointCreateContact(world, contactgroup, ref TerrainContact);
|
||||
joint = OdeNative.JointCreateContact(world, contactgroup, ref TerrainContact);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
}
|
||||
|
@ -1219,7 +1219,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath)
|
||||
{
|
||||
joint = SafeNativeMethods.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]);
|
||||
joint = OdeNative.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
}
|
||||
|
@ -1245,7 +1245,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath)
|
||||
{
|
||||
joint = SafeNativeMethods.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]);
|
||||
joint = OdeNative.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath)
|
||||
{
|
||||
joint = SafeNativeMethods.JointCreateContact(world, contactgroup, ref WaterContact);
|
||||
joint = OdeNative.JointCreateContact(world, contactgroup, ref WaterContact);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
//m_log.Info("[PHYSICS]: Prim Water Contact" + contact.depth);
|
||||
|
@ -1296,7 +1296,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath)
|
||||
{
|
||||
joint = SafeNativeMethods.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact);
|
||||
joint = OdeNative.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
}
|
||||
|
@ -1307,7 +1307,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath)
|
||||
{
|
||||
joint = SafeNativeMethods.JointCreateContact(world, contactgroup, ref contact);
|
||||
joint = OdeNative.JointCreateContact(world, contactgroup, ref contact);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
}
|
||||
|
@ -1328,7 +1328,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath)
|
||||
{
|
||||
joint = SafeNativeMethods.JointCreateContact(world, contactgroup, ref m_materialContacts[material, 0]);
|
||||
joint = OdeNative.JointCreateContact(world, contactgroup, ref m_materialContacts[material, 0]);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
}
|
||||
|
@ -1336,7 +1336,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
if (m_global_contactcount < maxContactsbeforedeath && joint != IntPtr.Zero) // stack collide!
|
||||
{
|
||||
SafeNativeMethods.JointAttach(joint, b1, b2);
|
||||
OdeNative.JointAttach(joint, b1, b2);
|
||||
m_global_contactcount++;
|
||||
}
|
||||
}
|
||||
|
@ -1356,7 +1356,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
}
|
||||
|
||||
private bool checkDupe(SafeNativeMethods.ContactGeom contactGeom, int atype)
|
||||
private bool checkDupe(OdeNative.ContactGeom contactGeom, int atype)
|
||||
{
|
||||
if (!m_filterCollisions)
|
||||
return false;
|
||||
|
@ -1365,7 +1365,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
ActorTypes at = (ActorTypes)atype;
|
||||
|
||||
foreach (SafeNativeMethods.ContactGeom contact in _perloopContact)
|
||||
foreach (OdeNative.ContactGeom contact in _perloopContact)
|
||||
{
|
||||
//if ((contact.g1 == contactGeom.g1 && contact.g2 == contactGeom.g2))
|
||||
//{
|
||||
|
@ -1552,7 +1552,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
List<OdePrim> removeprims = null;
|
||||
foreach (OdePrim chr in _activeprims)
|
||||
{
|
||||
if (chr.Body != IntPtr.Zero && SafeNativeMethods.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
|
||||
if (chr.Body != IntPtr.Zero && OdeNative.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1678,7 +1678,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(0);
|
||||
OdeNative.AllocateODEDataForThread(0);
|
||||
|
||||
OdeCharacter newAv
|
||||
= new OdeCharacter(
|
||||
|
@ -1701,7 +1701,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
lock (OdeLock)
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(0);
|
||||
OdeNative.AllocateODEDataForThread(0);
|
||||
|
||||
((OdeCharacter) actor).Destroy();
|
||||
}
|
||||
|
@ -1758,7 +1758,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
OdePrim newPrim;
|
||||
lock (OdeLock)
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(0);
|
||||
OdeNative.AllocateODEDataForThread(0);
|
||||
newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical);
|
||||
|
||||
lock (_prims)
|
||||
|
@ -1916,12 +1916,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
//{
|
||||
//int adfadf = 0;
|
||||
//}
|
||||
if (SafeNativeMethods.SpaceQuery(currentspace, geom) && currentspace != IntPtr.Zero)
|
||||
if (OdeNative.SpaceQuery(currentspace, geom) && currentspace != IntPtr.Zero)
|
||||
{
|
||||
if (SafeNativeMethods.GeomIsSpace(currentspace))
|
||||
if (OdeNative.GeomIsSpace(currentspace))
|
||||
{
|
||||
// waitForSpaceUnlock(currentspace);
|
||||
SafeNativeMethods.SpaceRemove(currentspace, geom);
|
||||
OdeNative.SpaceRemove(currentspace, geom);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1931,13 +1931,13 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
else
|
||||
{
|
||||
IntPtr sGeomIsIn = SafeNativeMethods.GeomGetSpace(geom);
|
||||
IntPtr sGeomIsIn = OdeNative.GeomGetSpace(geom);
|
||||
if (sGeomIsIn != IntPtr.Zero)
|
||||
{
|
||||
if (SafeNativeMethods.GeomIsSpace(currentspace))
|
||||
if (OdeNative.GeomIsSpace(currentspace))
|
||||
{
|
||||
// waitForSpaceUnlock(sGeomIsIn);
|
||||
SafeNativeMethods.SpaceRemove(sGeomIsIn, geom);
|
||||
OdeNative.SpaceRemove(sGeomIsIn, geom);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1948,13 +1948,13 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
|
||||
//If there are no more geometries in the sub-space, we don't need it in the main space anymore
|
||||
if (SafeNativeMethods.SpaceGetNumGeoms(currentspace) == 0)
|
||||
if (OdeNative.SpaceGetNumGeoms(currentspace) == 0)
|
||||
{
|
||||
if (currentspace != IntPtr.Zero)
|
||||
{
|
||||
if (SafeNativeMethods.GeomIsSpace(currentspace))
|
||||
if (OdeNative.GeomIsSpace(currentspace))
|
||||
{
|
||||
SafeNativeMethods.SpaceRemove(space, currentspace);
|
||||
OdeNative.SpaceRemove(space, currentspace);
|
||||
// free up memory used by the space.
|
||||
|
||||
resetSpaceArrayItemToZero(currentspace);
|
||||
|
@ -1972,12 +1972,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
// this is a physical object that got disabled. ;.;
|
||||
if (currentspace != IntPtr.Zero && geom != IntPtr.Zero)
|
||||
{
|
||||
if (SafeNativeMethods.SpaceQuery(currentspace, geom))
|
||||
if (OdeNative.SpaceQuery(currentspace, geom))
|
||||
{
|
||||
if (SafeNativeMethods.GeomIsSpace(currentspace))
|
||||
if (OdeNative.GeomIsSpace(currentspace))
|
||||
{
|
||||
// waitForSpaceUnlock(currentspace);
|
||||
SafeNativeMethods.SpaceRemove(currentspace, geom);
|
||||
OdeNative.SpaceRemove(currentspace, geom);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1987,13 +1987,13 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
else
|
||||
{
|
||||
IntPtr sGeomIsIn = SafeNativeMethods.GeomGetSpace(geom);
|
||||
IntPtr sGeomIsIn = OdeNative.GeomGetSpace(geom);
|
||||
if (sGeomIsIn != IntPtr.Zero)
|
||||
{
|
||||
if (SafeNativeMethods.GeomIsSpace(sGeomIsIn))
|
||||
if (OdeNative.GeomIsSpace(sGeomIsIn))
|
||||
{
|
||||
// waitForSpaceUnlock(sGeomIsIn);
|
||||
SafeNativeMethods.SpaceRemove(sGeomIsIn, geom);
|
||||
OdeNative.SpaceRemove(sGeomIsIn, geom);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2014,7 +2014,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
if (newspace == IntPtr.Zero)
|
||||
{
|
||||
newspace = createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]);
|
||||
SafeNativeMethods.HashSpaceSetLevels(newspace, HashspaceLow, HashspaceHigh);
|
||||
OdeNative.HashSpaceSetLevels(newspace, HashspaceLow, HashspaceHigh);
|
||||
}
|
||||
|
||||
return newspace;
|
||||
|
@ -2029,11 +2029,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
internal IntPtr createprimspace(int iprimspaceArrItemX, int iprimspaceArrItemY)
|
||||
{
|
||||
// creating a new space for prim and inserting it into main space.
|
||||
staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = SafeNativeMethods.HashSpaceCreate(IntPtr.Zero);
|
||||
SafeNativeMethods.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space);
|
||||
staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = OdeNative.HashSpaceCreate(IntPtr.Zero);
|
||||
OdeNative.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space);
|
||||
// waitForSpaceUnlock(space);
|
||||
SafeNativeMethods.SpaceSetSublevel(space, 1);
|
||||
SafeNativeMethods.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
|
||||
OdeNative.SpaceSetSublevel(space, 1);
|
||||
OdeNative.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
|
||||
|
||||
return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
|
||||
}
|
||||
|
@ -2253,7 +2253,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
m_log.InfoFormat("[Ode] start processing pending actor operations");
|
||||
int tstart = Util.EnvironmentTickCount();
|
||||
|
||||
SafeNativeMethods.AllocateODEDataForThread(0);
|
||||
OdeNative.AllocateODEDataForThread(0);
|
||||
|
||||
lock (_taintedPrims)
|
||||
{
|
||||
|
@ -2329,7 +2329,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
lock (OdeLock)
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
OdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
while (step_time > HalfOdeStep)
|
||||
{
|
||||
|
@ -2478,12 +2478,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
}
|
||||
|
||||
lock(SimulationLock)
|
||||
SafeNativeMethods.WorldQuickStep(world, ODE_STEPSIZE);
|
||||
OdeNative.WorldQuickStep(world, ODE_STEPSIZE);
|
||||
|
||||
if (CollectStats)
|
||||
m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick);
|
||||
|
||||
SafeNativeMethods.JointGroupEmpty(contactgroup);
|
||||
OdeNative.JointGroupEmpty(contactgroup);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -2531,7 +2531,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
foreach (OdePrim prim in _activeprims)
|
||||
{
|
||||
if (prim.IsPhysical && (SafeNativeMethods.BodyIsEnabled(prim.Body) || !prim._zeroFlag))
|
||||
if (prim.IsPhysical && (OdeNative.BodyIsEnabled(prim.Body) || !prim._zeroFlag))
|
||||
{
|
||||
prim.UpdatePositionAndVelocity();
|
||||
}
|
||||
|
@ -2558,7 +2558,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
fwriter.Close();
|
||||
}
|
||||
|
||||
SafeNativeMethods.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
|
||||
OdeNative.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
|
||||
}
|
||||
|
||||
latertickcount = Util.EnvironmentTickCountSubtract(tickCountFrameRun);
|
||||
|
@ -2670,7 +2670,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
lock (OdeLock)
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
OdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
IntPtr GroundGeom = IntPtr.Zero;
|
||||
if (RegionTerrain.TryGetValue(pOffset, out GroundGeom))
|
||||
|
@ -2682,29 +2682,29 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
TerrainHeightFieldHeights.Remove(GroundGeom);
|
||||
}
|
||||
SafeNativeMethods.SpaceRemove(space, GroundGeom);
|
||||
SafeNativeMethods.GeomDestroy(GroundGeom);
|
||||
OdeNative.SpaceRemove(space, GroundGeom);
|
||||
OdeNative.GeomDestroy(GroundGeom);
|
||||
}
|
||||
|
||||
}
|
||||
IntPtr HeightmapData = SafeNativeMethods.GeomHeightfieldDataCreate();
|
||||
SafeNativeMethods.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0,
|
||||
IntPtr HeightmapData = OdeNative.GeomHeightfieldDataCreate();
|
||||
OdeNative.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0,
|
||||
heightmapWidth, heightmapHeight,
|
||||
(int)heightmapWidthSamples,
|
||||
(int)heightmapHeightSamples,
|
||||
scale, offset, thickness, wrap);
|
||||
|
||||
SafeNativeMethods.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
|
||||
GroundGeom = SafeNativeMethods.CreateHeightfield(space, HeightmapData, 1);
|
||||
OdeNative.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
|
||||
GroundGeom = OdeNative.CreateHeightfield(space, HeightmapData, 1);
|
||||
if (GroundGeom != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(GroundGeom, (int)(CollisionCategories.Land));
|
||||
SafeNativeMethods.GeomSetCollideBits(GroundGeom, (int)(CollisionCategories.Space));
|
||||
OdeNative.GeomSetCategoryBits(GroundGeom, (int)(CollisionCategories.Land));
|
||||
OdeNative.GeomSetCollideBits(GroundGeom, (int)(CollisionCategories.Space));
|
||||
|
||||
}
|
||||
geom_name_map[GroundGeom] = "Terrain";
|
||||
|
||||
SafeNativeMethods.Matrix3 R = new SafeNativeMethods.Matrix3();
|
||||
OdeNative.Matrix3 R = new OdeNative.Matrix3();
|
||||
|
||||
Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f);
|
||||
Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f);
|
||||
|
@ -2714,9 +2714,9 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
float angle;
|
||||
q1.GetAxisAngle(out v3, out angle);
|
||||
|
||||
SafeNativeMethods.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
|
||||
SafeNativeMethods.GeomSetRotation(GroundGeom, ref R);
|
||||
SafeNativeMethods.GeomSetPosition(GroundGeom, pOffset.X + regionsizeX * 0.5f, pOffset.Y + regionsizeY * 0.5f, 0.0f);
|
||||
OdeNative.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
|
||||
OdeNative.GeomSetRotation(GroundGeom, ref R);
|
||||
OdeNative.GeomSetPosition(GroundGeom, pOffset.X + regionsizeX * 0.5f, pOffset.Y + regionsizeY * 0.5f, 0.0f);
|
||||
IntPtr testGround = IntPtr.Zero;
|
||||
if (RegionTerrain.TryGetValue(pOffset, out testGround))
|
||||
{
|
||||
|
@ -2755,7 +2755,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
|
||||
_worldInitialized = false;
|
||||
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
OdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
if (m_rayCastManager != null)
|
||||
{
|
||||
|
@ -2783,13 +2783,13 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
|||
{
|
||||
if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
|
||||
TerrainHeightFieldHeights.Remove(GroundGeom);
|
||||
SafeNativeMethods.GeomDestroy(GroundGeom);
|
||||
OdeNative.GeomDestroy(GroundGeom);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
SafeNativeMethods.WorldDestroy(world);
|
||||
OdeNative.WorldDestroy(world);
|
||||
world = IntPtr.Zero;
|
||||
}
|
||||
catch (AccessViolationException e)
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
//#endif
|
||||
|
||||
[SuppressUnmanagedCodeSecurityAttribute]
|
||||
internal static class SafeNativeMethods
|
||||
internal static class UBOdeNative
|
||||
{
|
||||
internal static dReal Infinity = dReal.MaxValue;
|
||||
internal static int NTotalBodies = 0;
|
||||
|
@ -250,7 +250,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
//needed for Contact only, rest should use the class
|
||||
internal struct ContactGeom
|
||||
{
|
||||
|
||||
internal Vector3 pos;
|
||||
internal Vector3 normal;
|
||||
internal dReal depth;
|
||||
|
@ -261,18 +260,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
internal static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(ContactGeom));
|
||||
}
|
||||
|
||||
/*
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct GeomClass
|
||||
{
|
||||
internal int bytes;
|
||||
internal GetColliderFnFn collider;
|
||||
internal GetAABBFn aabb;
|
||||
internal AABBTestFn aabb_test;
|
||||
internal GeomDtorFn dtor;
|
||||
}
|
||||
*/
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct JointFeedback
|
||||
{
|
||||
|
@ -282,7 +269,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
internal Vector3 t2;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct Mass
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
private Vector3 m_lastFallVel;
|
||||
private Quaternion m_orientation;
|
||||
private Quaternion m_orientation2D;
|
||||
private SafeNativeMethods.Quaternion m_NativeOrientation2D;
|
||||
private UBOdeNative.Quaternion m_NativeOrientation2D;
|
||||
private float m_mass = 80f;
|
||||
private float m_massInvTimeScaled = 1600f;
|
||||
public readonly float m_density = 60f;
|
||||
|
@ -151,7 +151,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
public IntPtr Amotor = IntPtr.Zero;
|
||||
|
||||
internal SafeNativeMethods.Mass ShellMass;
|
||||
internal UBOdeNative.Mass ShellMass;
|
||||
|
||||
public int m_eventsubscription = 0;
|
||||
private int m_cureventsubscription = 0;
|
||||
|
@ -837,7 +837,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
m_pidControllerActive = true;
|
||||
_acceleration = accel;
|
||||
if (Body != IntPtr.Zero)
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -911,19 +911,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
CapsuleRadius *= 0.5f;
|
||||
CapsuleSizeZ = 0.5f * sz;
|
||||
|
||||
collider = SafeNativeMethods.CreateCapsule(m_parent_scene.TopSpace, CapsuleRadius, l);
|
||||
SafeNativeMethods.GeomSetCategoryBits(collider, (uint)m_collisionCategories);
|
||||
SafeNativeMethods.GeomSetCollideBits(collider, (uint)m_collisionFlags);
|
||||
collider = UBOdeNative.CreateCapsule(m_parent_scene.TopSpace, CapsuleRadius, l);
|
||||
UBOdeNative.GeomSetCategoryBits(collider, (uint)m_collisionCategories);
|
||||
UBOdeNative.GeomSetCollideBits(collider, (uint)m_collisionFlags);
|
||||
|
||||
// update mass
|
||||
m_mass = m_density * sx * sy * sz;
|
||||
SafeNativeMethods.MassSetBoxTotal(out ShellMass, m_mass, sx, sy, sz);
|
||||
UBOdeNative.MassSetBoxTotal(out ShellMass, m_mass, sx, sy, sz);
|
||||
m_massInvTimeScaled = m_mass * m_sceneInverseTimeStep;
|
||||
PID_D = basePID_D * m_massInvTimeScaled;
|
||||
PID_P = basePID_P * m_massInvTimeScaled;
|
||||
m_scenegravityForceZ = m_sceneGravityZ * m_mass;
|
||||
|
||||
Body = SafeNativeMethods.BodyCreate(m_parent_scene.world);
|
||||
Body = UBOdeNative.BodyCreate(m_parent_scene.world);
|
||||
|
||||
_zeroFlag = false;
|
||||
m_pidControllerActive = true;
|
||||
|
@ -932,52 +932,52 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
_velocity = Vector3.Zero;
|
||||
|
||||
// SafeNativeMethods.BodySetAutoDisableFlag(Body,false);
|
||||
SafeNativeMethods.BodySetAutoDisableFlag(Body, true);
|
||||
UBOdeNative.BodySetAutoDisableFlag(Body, true);
|
||||
m_bodydisablecontrol = 0;
|
||||
|
||||
SafeNativeMethods.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
UBOdeNative.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
|
||||
SafeNativeMethods.BodySetMass(Body, ref ShellMass);
|
||||
UBOdeNative.BodySetMass(Body, ref ShellMass);
|
||||
//SafeNativeMethods.GeomSetBody(capsule, Body);
|
||||
SafeNativeMethods.GeomSetBody(collider, Body);
|
||||
UBOdeNative.GeomSetBody(collider, Body);
|
||||
|
||||
// The purpose of the AMotor here is to keep the avatar's physical
|
||||
// surrogate from rotating while moving
|
||||
Amotor = SafeNativeMethods.JointCreateAMotor(m_parent_scene.world, IntPtr.Zero);
|
||||
SafeNativeMethods.JointAttach(Amotor, Body, IntPtr.Zero);
|
||||
Amotor = UBOdeNative.JointCreateAMotor(m_parent_scene.world, IntPtr.Zero);
|
||||
UBOdeNative.JointAttach(Amotor, Body, IntPtr.Zero);
|
||||
|
||||
SafeNativeMethods.JointSetAMotorMode(Amotor, 0);
|
||||
SafeNativeMethods.JointSetAMotorNumAxes(Amotor, 3);
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
|
||||
SafeNativeMethods.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
|
||||
UBOdeNative.JointSetAMotorMode(Amotor, 0);
|
||||
UBOdeNative.JointSetAMotorNumAxes(Amotor, 3);
|
||||
UBOdeNative.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
|
||||
UBOdeNative.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
|
||||
UBOdeNative.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
|
||||
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, 0, 0);
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, 1, 0);
|
||||
SafeNativeMethods.JointSetAMotorAngle(Amotor, 2, 0);
|
||||
UBOdeNative.JointSetAMotorAngle(Amotor, 0, 0);
|
||||
UBOdeNative.JointSetAMotorAngle(Amotor, 1, 0);
|
||||
UBOdeNative.JointSetAMotorAngle(Amotor, 2, 0);
|
||||
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0f); // make it HARD
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0f); // make it HARD
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f);
|
||||
|
||||
// These lowstops and high stops are effectively (no wiggle room)
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -1e-5f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 1e-5f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -1e-5f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 1e-5f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -1e-5f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 1e-5f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -1e-5f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 1e-5f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -1e-5f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 1e-5f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -1e-5f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 1e-5f);
|
||||
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel, 0);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel2, 0);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel3, 0);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)UBOdeNative.JointParam.Vel, 0);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)UBOdeNative.JointParam.Vel2, 0);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)UBOdeNative.JointParam.Vel3, 0);
|
||||
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.FMax, 5e8f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.FMax2, 5e8f);
|
||||
SafeNativeMethods.JointSetAMotorParam(Amotor, (int)dParam.FMax3, 5e8f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.FMax, 5e8f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.FMax2, 5e8f);
|
||||
UBOdeNative.JointSetAMotorParam(Amotor, (int)dParam.FMax3, 5e8f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -989,14 +989,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
// Kill the Amotor
|
||||
if (Amotor != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.JointDestroy(Amotor);
|
||||
UBOdeNative.JointDestroy(Amotor);
|
||||
Amotor = IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
//kill the body
|
||||
SafeNativeMethods.BodyDestroy(Body);
|
||||
UBOdeNative.BodyDestroy(Body);
|
||||
Body = IntPtr.Zero;
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
m_parent_scene.actor_name_map.Remove(collider);
|
||||
//m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace);
|
||||
SafeNativeMethods.GeomDestroy(collider);
|
||||
UBOdeNative.GeomDestroy(collider);
|
||||
collider = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
@ -1059,8 +1059,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal bool Collide(IntPtr me, IntPtr other, bool reverse, ref SafeNativeMethods.ContactGeom contact,
|
||||
ref SafeNativeMethods.ContactGeom altContact, ref bool useAltcontact, ref bool feetcollision)
|
||||
internal bool Collide(IntPtr me, IntPtr other, bool reverse, ref UBOdeNative.ContactGeom contact,
|
||||
ref UBOdeNative.ContactGeom altContact, ref bool useAltcontact, ref bool feetcollision)
|
||||
{
|
||||
feetcollision = false;
|
||||
useAltcontact = false;
|
||||
|
@ -1076,8 +1076,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
offset.X = contact.pos.X - _position.X;
|
||||
offset.Y = contact.pos.Y - _position.Y;
|
||||
|
||||
SafeNativeMethods.GeomClassID gtype = SafeNativeMethods.GeomGetClass(other);
|
||||
if (gtype == SafeNativeMethods.GeomClassID.CapsuleClass)
|
||||
UBOdeNative.GeomClassID gtype = UBOdeNative.GeomGetClass(other);
|
||||
if (gtype == UBOdeNative.GeomClassID.CapsuleClass)
|
||||
{
|
||||
Vector3 roff = offset * Quaternion.Inverse(m_orientation2D);
|
||||
float r = roff.X * roff.X / AvaAvaSizeXsq;
|
||||
|
@ -1105,9 +1105,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
return true;
|
||||
}
|
||||
|
||||
if (gtype == SafeNativeMethods.GeomClassID.SphereClass && SafeNativeMethods.GeomGetBody(other) != IntPtr.Zero)
|
||||
if (gtype == UBOdeNative.GeomClassID.SphereClass && UBOdeNative.GeomGetBody(other) != IntPtr.Zero)
|
||||
{
|
||||
if (SafeNativeMethods.GeomSphereGetRadius(other) < 0.5)
|
||||
if (UBOdeNative.GeomSphereGetRadius(other) < 0.5)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1194,25 +1194,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (Body == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
if (!SafeNativeMethods.BodyIsEnabled(Body))
|
||||
if (!UBOdeNative.BodyIsEnabled(Body))
|
||||
{
|
||||
if (++m_bodydisablecontrol < 50)
|
||||
return;
|
||||
|
||||
// clear residuals
|
||||
SafeNativeMethods.BodySetAngularVel(Body, 0f, 0f, 0f);
|
||||
SafeNativeMethods.BodySetLinearVel(Body, 0f, 0f, 0f);
|
||||
UBOdeNative.BodySetAngularVel(Body, 0f, 0f, 0f);
|
||||
UBOdeNative.BodySetLinearVel(Body, 0f, 0f, 0f);
|
||||
_zeroFlag = true;
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
|
||||
m_bodydisablecontrol = 0;
|
||||
|
||||
// the Amotor still lets avatar rotation to drift during colisions
|
||||
// so force it back to identity
|
||||
SafeNativeMethods.BodySetQuaternion(Body, ref m_NativeOrientation2D);
|
||||
UBOdeNative.BodySetQuaternion(Body, ref m_NativeOrientation2D);
|
||||
|
||||
_position = SafeNativeMethods.BodyGetPositionOMV(Body);
|
||||
_position = UBOdeNative.BodyGetPositionOMV(Body);
|
||||
// check outbounds forcing to be in world
|
||||
bool fixbody = false;
|
||||
if ((Single.IsNaN(_position.X) || Single.IsInfinity(_position.X)))
|
||||
|
@ -1256,7 +1256,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (fixbody)
|
||||
{
|
||||
m_freemove = false;
|
||||
SafeNativeMethods.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
UBOdeNative.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
}
|
||||
|
||||
if (m_pidControllerActive == false)
|
||||
|
@ -1282,7 +1282,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
ctz.Y *= m_walkMultiplier;
|
||||
}
|
||||
|
||||
Vector3 vel = SafeNativeMethods.BodyGetLinearVelOMV(Body);
|
||||
Vector3 vel = UBOdeNative.BodyGetLinearVelOMV(Body);
|
||||
|
||||
//******************************************
|
||||
// colide with land
|
||||
|
@ -1620,7 +1620,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
}
|
||||
|
||||
if ((vec.Z != 0 || vec.X != 0 || vec.Y != 0))
|
||||
SafeNativeMethods.BodyAddForce(Body, vec.X, vec.Y, vec.Z);
|
||||
UBOdeNative.BodyAddForce(Body, vec.X, vec.Y, vec.Z);
|
||||
|
||||
if (_zeroFlag)
|
||||
{
|
||||
|
@ -1635,7 +1635,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
a = (_velocity - a) * m_sceneInverseTimeStep;
|
||||
SetSmooth(ref _acceleration, ref a, 2);
|
||||
|
||||
m_rotationalVelocity = SafeNativeMethods.BodyGetAngularVelOMVforAvatar(Body);
|
||||
m_rotationalVelocity = UBOdeNative.BodyGetAngularVelOMVforAvatar(Body);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1820,7 +1820,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (m_cureventsubscription < m_eventsubscription)
|
||||
return;
|
||||
|
||||
if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body))
|
||||
if (Body != IntPtr.Zero && !UBOdeNative.BodyIsEnabled(Body))
|
||||
return;
|
||||
|
||||
lock (CollisionEventsThisFrame)
|
||||
|
@ -1938,19 +1938,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
CapsuleRadius *= 0.5f;
|
||||
CapsuleSizeZ= 0.5f * sz;
|
||||
//SafeNativeMethods.GeomCapsuleSetParams(capsule, r, l);
|
||||
SafeNativeMethods.GeomCapsuleSetParams(collider, CapsuleRadius, l);
|
||||
UBOdeNative.GeomCapsuleSetParams(collider, CapsuleRadius, l);
|
||||
|
||||
m_mass = m_density * sx * sy * sz; // update mass
|
||||
m_massInvTimeScaled = m_mass * m_sceneInverseTimeStep;
|
||||
PID_D = basePID_D * m_massInvTimeScaled;
|
||||
PID_P = basePID_P * m_massInvTimeScaled;
|
||||
SafeNativeMethods.MassSetBoxTotal(out ShellMass, m_mass, sx, sy, sz);
|
||||
SafeNativeMethods.BodySetMass(Body, ref ShellMass);
|
||||
UBOdeNative.MassSetBoxTotal(out ShellMass, m_mass, sx, sy, sz);
|
||||
UBOdeNative.BodySetMass(Body, ref ShellMass);
|
||||
|
||||
m_scenegravityForceZ = m_sceneGravityZ * m_mass;
|
||||
|
||||
_position.Z += (sz - oldsz) * 0.5f;
|
||||
SafeNativeMethods.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
UBOdeNative.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
|
||||
|
||||
UpdateAABB2D();
|
||||
|
||||
|
@ -1973,8 +1973,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetPosition(Body, newPos.X, newPos.Y, newPos.Z);
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodySetPosition(Body, newPos.X, newPos.Y, newPos.Z);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
_position = newPos;
|
||||
UpdateAABB2D();
|
||||
|
@ -2017,12 +2017,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetQuaternion(Body, ref m_NativeOrientation2D);
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodySetQuaternion(Body, ref m_NativeOrientation2D);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
}
|
||||
else if (Body != IntPtr.Zero)
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
@ -2033,8 +2033,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2045,7 +2045,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
//m_freemove = false;
|
||||
m_targetVelocity = newVel;
|
||||
if (Body != IntPtr.Zero)
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
@ -2119,8 +2119,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
if (newForce.X != 0f || newForce.Y != 0f || newForce.Z != 0)
|
||||
SafeNativeMethods.BodyAddForce(Body, newForce.X, newForce.Y, newForce.Z);
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodyAddForce(Body, newForce.X, newForce.Y, newForce.Z);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2133,8 +2133,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.BodySetLinearVel(Body, newmomentum.X, newmomentum.Y, newmomentum.Z);
|
||||
SafeNativeMethods.BodyEnable(Body);
|
||||
UBOdeNative.BodySetLinearVel(Body, newmomentum.X, newmomentum.Y, newmomentum.Z);
|
||||
UBOdeNative.BodyEnable(Body);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -336,9 +336,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
m_amEfect = 1.0f ; // turn it on
|
||||
m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
|
||||
|
||||
if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body)
|
||||
if (rootPrim.Body != IntPtr.Zero && !UBOdeNative.BodyIsEnabled(rootPrim.Body)
|
||||
&& !rootPrim.m_isSelected && !rootPrim.m_disabled)
|
||||
SafeNativeMethods.BodyEnable(rootPrim.Body);
|
||||
UBOdeNative.BodyEnable(rootPrim.Body);
|
||||
|
||||
break;
|
||||
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
||||
|
@ -355,9 +355,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
m_lmEfect = 1.0f; // turn it on
|
||||
|
||||
m_ffactor = 0.0f;
|
||||
if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body)
|
||||
if (rootPrim.Body != IntPtr.Zero && !UBOdeNative.BodyIsEnabled(rootPrim.Body)
|
||||
&& !rootPrim.m_isSelected && !rootPrim.m_disabled)
|
||||
SafeNativeMethods.BodyEnable(rootPrim.Body);
|
||||
UBOdeNative.BodyEnable(rootPrim.Body);
|
||||
break;
|
||||
case Vehicle.LINEAR_MOTOR_OFFSET:
|
||||
m_linearMotorOffset = new Vector3(pValue, pValue, pValue);
|
||||
|
@ -393,9 +393,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
m_amEfect = 1.0f; // turn it on
|
||||
m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
|
||||
|
||||
if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body)
|
||||
if (rootPrim.Body != IntPtr.Zero && !UBOdeNative.BodyIsEnabled(rootPrim.Body)
|
||||
&& !rootPrim.m_isSelected && !rootPrim.m_disabled)
|
||||
SafeNativeMethods.BodyEnable(rootPrim.Body);
|
||||
UBOdeNative.BodyEnable(rootPrim.Body);
|
||||
break;
|
||||
case Vehicle.LINEAR_FRICTION_TIMESCALE:
|
||||
if (pValue.X < m_timestep) pValue.X = m_timestep;
|
||||
|
@ -413,9 +413,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale;
|
||||
|
||||
m_ffactor = 0.0f;
|
||||
if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body)
|
||||
if (rootPrim.Body != IntPtr.Zero && !UBOdeNative.BodyIsEnabled(rootPrim.Body)
|
||||
&& !rootPrim.m_isSelected && !rootPrim.m_disabled)
|
||||
SafeNativeMethods.BodyEnable(rootPrim.Body);
|
||||
UBOdeNative.BodyEnable(rootPrim.Body);
|
||||
break;
|
||||
case Vehicle.LINEAR_MOTOR_OFFSET:
|
||||
m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
|
||||
|
@ -766,30 +766,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
IntPtr Body = rootPrim.Body;
|
||||
|
||||
SafeNativeMethods.Mass dmass;
|
||||
SafeNativeMethods.BodyGetMass(Body, out dmass);
|
||||
UBOdeNative.Mass dmass;
|
||||
UBOdeNative.BodyGetMass(Body, out dmass);
|
||||
|
||||
SafeNativeMethods.Quaternion rot = SafeNativeMethods.BodyGetQuaternion(Body);
|
||||
UBOdeNative.Quaternion rot = UBOdeNative.BodyGetQuaternion(Body);
|
||||
Quaternion objrotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object
|
||||
Quaternion rotq = objrotq; // rotq = rotation of object
|
||||
rotq *= m_referenceFrame; // rotq is now rotation in vehicle reference frame
|
||||
Quaternion irotq = Quaternion.Inverse(rotq);
|
||||
|
||||
SafeNativeMethods.Vector3 dvtmp;
|
||||
UBOdeNative.Vector3 dvtmp;
|
||||
Vector3 tmpV;
|
||||
Vector3 curVel; // velocity in world
|
||||
Vector3 curAngVel; // angular velocity in world
|
||||
Vector3 force = Vector3.Zero; // actually linear aceleration until mult by mass in world frame
|
||||
Vector3 torque = Vector3.Zero;// actually angular aceleration until mult by Inertia in vehicle frame
|
||||
SafeNativeMethods.Vector3 dtorque = new SafeNativeMethods.Vector3();
|
||||
UBOdeNative.Vector3 dtorque = new UBOdeNative.Vector3();
|
||||
|
||||
dvtmp = SafeNativeMethods.BodyGetLinearVel(Body);
|
||||
dvtmp = UBOdeNative.BodyGetLinearVel(Body);
|
||||
curVel.X = dvtmp.X;
|
||||
curVel.Y = dvtmp.Y;
|
||||
curVel.Z = dvtmp.Z;
|
||||
Vector3 curLocalVel = curVel * irotq; // current velocity in local
|
||||
|
||||
dvtmp = SafeNativeMethods.BodyGetAngularVel(Body);
|
||||
dvtmp = UBOdeNative.BodyGetAngularVel(Body);
|
||||
curAngVel.X = dvtmp.X;
|
||||
curAngVel.Y = dvtmp.Y;
|
||||
curAngVel.Z = dvtmp.Z;
|
||||
|
@ -833,7 +833,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
// have offset, do it now
|
||||
tmpV *= dmass.mass;
|
||||
SafeNativeMethods.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z);
|
||||
UBOdeNative.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -856,7 +856,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (m_VhoverTimescale < 300 && rootPrim.m_prim_geom != IntPtr.Zero)
|
||||
{
|
||||
// d.Vector3 pos = d.BodyGetPosition(Body);
|
||||
SafeNativeMethods.Vector3 pos = SafeNativeMethods.GeomGetPosition(rootPrim.m_prim_geom);
|
||||
UBOdeNative.Vector3 pos = UBOdeNative.GeomGetPosition(rootPrim.m_prim_geom);
|
||||
pos.Z -= 0.21f; // minor offset that seems to be always there in sl
|
||||
|
||||
float t = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y);
|
||||
|
@ -1174,7 +1174,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
if (force.X != 0 || force.Y != 0 || force.Z != 0)
|
||||
{
|
||||
SafeNativeMethods.BodyAddForce(Body, force.X, force.Y, force.Z);
|
||||
UBOdeNative.BodyAddForce(Body, force.X, force.Y, force.Z);
|
||||
}
|
||||
|
||||
if (torque.X != 0 || torque.Y != 0 || torque.Z != 0)
|
||||
|
@ -1184,15 +1184,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
dtorque.Y = torque.Y;
|
||||
dtorque.Z = torque.Z;
|
||||
|
||||
SafeNativeMethods.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque);
|
||||
SafeNativeMethods.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame
|
||||
UBOdeNative.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque);
|
||||
UBOdeNative.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame
|
||||
}
|
||||
|
||||
torque = rootPrim.m_torque;
|
||||
torque += rootPrim.m_angularForceacc;
|
||||
rootPrim.m_angularForceacc = Vector3.Zero;
|
||||
if (torque.X != 0 || torque.Y != 0 || torque.Z != 0)
|
||||
SafeNativeMethods.BodyAddTorque(Body,torque.X, torque.Y, torque.Z);
|
||||
UBOdeNative.BodyAddTorque(Body,torque.X, torque.Y, torque.Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (Util.IsWindows())
|
||||
Util.LoadArchSpecificWindowsDll("ubode.dll");
|
||||
|
||||
SafeNativeMethods.InitODE();
|
||||
UBOdeNative.InitODE();
|
||||
|
||||
string ode_config = SafeNativeMethods.GetConfiguration();
|
||||
string ode_config = UBOdeNative.GetConfiguration();
|
||||
if (string.IsNullOrEmpty(ode_config))
|
||||
{
|
||||
m_log.Error("[ubODE] Native ode library version not supported");
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -53,7 +53,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
/// Scene that created this object.
|
||||
/// </summary>
|
||||
private readonly ODEScene m_scene;
|
||||
private readonly SafeNativeMethods.ContactGeom[] m_contacts;
|
||||
private readonly UBOdeNative.ContactGeom[] m_contacts;
|
||||
|
||||
IntPtr ray; // the ray. we only need one for our lifetime
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
/// <summary>
|
||||
/// ODE near callback delegate
|
||||
/// </summary>
|
||||
private readonly SafeNativeMethods.NearCallback nearCallback;
|
||||
private readonly UBOdeNative.NearCallback nearCallback;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private readonly List<ContactResult> m_contactResults = new List<ContactResult>();
|
||||
private RayFilterFlags CurrentRayFilter;
|
||||
|
@ -76,8 +76,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
m_scene = pScene;
|
||||
m_contacts = pScene.m_contacts;
|
||||
nearCallback = near;
|
||||
ray = SafeNativeMethods.CreateRay(IntPtr.Zero, 1.0f);
|
||||
SafeNativeMethods.GeomSetCategoryBits(ray, 0);
|
||||
ray = UBOdeNative.CreateRay(IntPtr.Zero, 1.0f);
|
||||
UBOdeNative.GeomSetCategoryBits(ray, 0);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
@ -132,22 +132,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
unchecked
|
||||
{
|
||||
CollisionContactGeomsPerTest = ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0) ?
|
||||
CurrentMaxCount | (int)SafeNativeMethods.CONTACTS_UNIMPORTANT : CurrentMaxCount;
|
||||
CurrentMaxCount | (int)UBOdeNative.CONTACTS_UNIMPORTANT : CurrentMaxCount;
|
||||
}
|
||||
|
||||
int backfacecull = ((CurrentRayFilter & RayFilterFlags.BackFaceCull) == 0 ? 0 : 1);
|
||||
SafeNativeMethods.GeomRaySetParams(ray, 0, backfacecull);
|
||||
UBOdeNative.GeomRaySetParams(ray, 0, backfacecull);
|
||||
|
||||
if (req.callbackMethod is RaycastCallback)
|
||||
{
|
||||
// if we only want one get only one per Collision pair saving memory
|
||||
CurrentRayFilter |= RayFilterFlags.ClosestHit;
|
||||
SafeNativeMethods.GeomRaySetClosestHit(ray, 1);
|
||||
UBOdeNative.GeomRaySetClosestHit(ray, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int closestHit = ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0 ? 0 : 1);
|
||||
SafeNativeMethods.GeomRaySetClosestHit(ray, closestHit);
|
||||
UBOdeNative.GeomRaySetClosestHit(ray, closestHit);
|
||||
}
|
||||
|
||||
if (geom == IntPtr.Zero)
|
||||
|
@ -167,14 +167,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
if (catflags != 0)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCollideBits(ray, (uint)catflags);
|
||||
UBOdeNative.GeomSetCollideBits(ray, (uint)catflags);
|
||||
doSpaceRay(req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if we select a geom don't use filters
|
||||
SafeNativeMethods.GeomSetCollideBits(ray, (uint)CollisionCategories.All);
|
||||
UBOdeNative.GeomSetCollideBits(ray, (uint)CollisionCategories.All);
|
||||
doGeomRay(req,geom);
|
||||
}
|
||||
|
||||
|
@ -250,12 +250,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
}
|
||||
*/
|
||||
|
||||
SafeNativeMethods.GeomRaySetLength(ray, req.length);
|
||||
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
|
||||
UBOdeNative.GeomRaySetLength(ray, req.length);
|
||||
UBOdeNative.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
|
||||
|
||||
// Collide tests
|
||||
if ((CurrentRayFilter & FilterActiveSpace) != 0)
|
||||
SafeNativeMethods.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
|
||||
UBOdeNative.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
|
||||
|
||||
if ((CurrentRayFilter & RayFilterFlags.agent) != 0)
|
||||
{
|
||||
|
@ -268,7 +268,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
}
|
||||
|
||||
if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
|
||||
SafeNativeMethods.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
|
||||
UBOdeNative.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
|
||||
|
||||
if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
float tmp2 = req.length * req.length - tmp + 2500;
|
||||
tmp2 = (float)Math.Sqrt(tmp2);
|
||||
SafeNativeMethods.GeomRaySetLength(ray, tmp2);
|
||||
UBOdeNative.GeomRaySetLength(ray, tmp2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -337,11 +337,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void doGeomRay(ODERayRequest req, IntPtr geom)
|
||||
{
|
||||
SafeNativeMethods.GeomRaySetLength(ray, req.length);
|
||||
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
|
||||
UBOdeNative.GeomRaySetLength(ray, req.length);
|
||||
UBOdeNative.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
|
||||
|
||||
// Collide test
|
||||
SafeNativeMethods.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test
|
||||
UBOdeNative.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test
|
||||
|
||||
if (req.callbackMethod is RaycastCallback)
|
||||
{
|
||||
|
@ -394,11 +394,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (m_contactResults.Count >= CurrentMaxCount)
|
||||
return;
|
||||
|
||||
if (SafeNativeMethods.GeomIsSpace(g2))
|
||||
if (UBOdeNative.GeomIsSpace(g2))
|
||||
{
|
||||
try
|
||||
{
|
||||
SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
|
||||
UBOdeNative.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -410,7 +410,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
int count = 0;
|
||||
try
|
||||
{
|
||||
count = SafeNativeMethods.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
|
||||
count = UBOdeNative.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, UBOdeNative.ContactGeom.unmanagedSizeOf);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -512,7 +512,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
int count = 0;
|
||||
try
|
||||
{
|
||||
count = SafeNativeMethods.CollidePtr(ray, chr.collider, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
|
||||
count = UBOdeNative.CollidePtr(ray, chr.collider, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, UBOdeNative.ContactGeom.unmanagedSizeOf);
|
||||
if (count == 0)
|
||||
return;
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
int count = 0;
|
||||
try
|
||||
{
|
||||
count = SafeNativeMethods.CollidePtr(ray, terrain, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
|
||||
count = UBOdeNative.CollidePtr(ray, terrain, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, UBOdeNative.ContactGeom.unmanagedSizeOf);
|
||||
if (count == 0)
|
||||
return;
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
if (ray != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.GeomDestroy(ray);
|
||||
UBOdeNative.GeomDestroy(ray);
|
||||
ray = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
//private int threadid = 0;
|
||||
|
||||
const SafeNativeMethods.ContactFlags commomContactFlags = SafeNativeMethods.ContactFlags.Bounce | SafeNativeMethods.ContactFlags.Approx1;
|
||||
const UBOdeNative.ContactFlags commomContactFlags = UBOdeNative.ContactFlags.Bounce | UBOdeNative.ContactFlags.Approx1;
|
||||
const float commomContactERP = 0.75f;
|
||||
const float commonContactCFM = 0.0001f;
|
||||
const float commomContactSLIP = 0f;
|
||||
|
@ -221,7 +221,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
public int bodyFramesAutoDisable = 10;
|
||||
|
||||
private SafeNativeMethods.NearCallback NearCallback;
|
||||
private UBOdeNative.NearCallback NearCallback;
|
||||
|
||||
private readonly Dictionary<uint, OdePrim> _prims = new Dictionary<uint, OdePrim>();
|
||||
private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
|
||||
|
@ -244,12 +244,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
private int contactsPerCollision = 80;
|
||||
internal IntPtr ContactgeomsArray = IntPtr.Zero;
|
||||
internal SafeNativeMethods.ContactGeom[] m_contacts;
|
||||
internal UBOdeNative.ContactGeom[] m_contacts;
|
||||
internal GCHandle m_contactsHandler;
|
||||
|
||||
private IntPtr GlobalContactsArray;
|
||||
|
||||
private SafeNativeMethods.Contact contactSharedForJoints = new SafeNativeMethods.Contact();
|
||||
private UBOdeNative.Contact contactSharedForJoints = new UBOdeNative.Contact();
|
||||
|
||||
const int maxContactJoints = 6000;
|
||||
private volatile int ContactJointCount = 0;
|
||||
|
@ -341,7 +341,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
/// </summary>
|
||||
private void Initialization()
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
UBOdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
NearCallback = DefaultNearCallback;
|
||||
|
||||
|
@ -357,12 +357,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
// Create the world and the first space
|
||||
try
|
||||
{
|
||||
world = SafeNativeMethods.WorldCreate();
|
||||
TopSpace = SafeNativeMethods.SimpleSpaceCreate(IntPtr.Zero);
|
||||
ActiveSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace);
|
||||
world = UBOdeNative.WorldCreate();
|
||||
TopSpace = UBOdeNative.SimpleSpaceCreate(IntPtr.Zero);
|
||||
ActiveSpace = UBOdeNative.SimpleSpaceCreate(TopSpace);
|
||||
float sx = m_regionWidth + 16;
|
||||
float sy = m_regionHeight + 16;
|
||||
SafeNativeMethods.Vector3 px = new SafeNativeMethods.Vector3(sx * 0.5f, sy * 0.5f, 0);
|
||||
UBOdeNative.Vector3 px = new UBOdeNative.Vector3(sx * 0.5f, sy * 0.5f, 0);
|
||||
if (sx < sy)
|
||||
sx = sy;
|
||||
int dp = Util.intLog2((uint)sx);
|
||||
|
@ -370,42 +370,42 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
dp = 8;
|
||||
else if(dp < 4)
|
||||
dp = 4;
|
||||
StaticSpace = SafeNativeMethods.QuadTreeSpaceCreate(TopSpace, ref px, ref px, dp);
|
||||
StaticSpace = UBOdeNative.QuadTreeSpaceCreate(TopSpace, ref px, ref px, dp);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
// move to high level
|
||||
SafeNativeMethods.SpaceSetSublevel(ActiveSpace, 1);
|
||||
SafeNativeMethods.SpaceSetSublevel(StaticSpace, 1);
|
||||
UBOdeNative.SpaceSetSublevel(ActiveSpace, 1);
|
||||
UBOdeNative.SpaceSetSublevel(StaticSpace, 1);
|
||||
|
||||
SafeNativeMethods.GeomSetCategoryBits(ActiveSpace, (uint)(CollisionCategories.Space |
|
||||
UBOdeNative.GeomSetCategoryBits(ActiveSpace, (uint)(CollisionCategories.Space |
|
||||
CollisionCategories.Geom |
|
||||
CollisionCategories.Character |
|
||||
CollisionCategories.Phantom |
|
||||
CollisionCategories.VolumeDtc
|
||||
));
|
||||
SafeNativeMethods.GeomSetCollideBits(ActiveSpace, (uint)(CollisionCategories.Space |
|
||||
UBOdeNative.GeomSetCollideBits(ActiveSpace, (uint)(CollisionCategories.Space |
|
||||
CollisionCategories.Geom |
|
||||
CollisionCategories.Character |
|
||||
CollisionCategories.Phantom |
|
||||
CollisionCategories.VolumeDtc
|
||||
));
|
||||
|
||||
SafeNativeMethods.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space |
|
||||
UBOdeNative.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space |
|
||||
CollisionCategories.Geom |
|
||||
//CollisionCategories.Land |
|
||||
//CollisionCategories.Water |
|
||||
CollisionCategories.Phantom |
|
||||
CollisionCategories.VolumeDtc
|
||||
));
|
||||
SafeNativeMethods.GeomSetCollideBits(StaticSpace, 0);
|
||||
UBOdeNative.GeomSetCollideBits(StaticSpace, 0);
|
||||
|
||||
JointContactGroup = SafeNativeMethods.JointGroupCreate(maxContactJoints + 1);
|
||||
JointContactGroup = UBOdeNative.JointGroupCreate(maxContactJoints + 1);
|
||||
//contactgroup
|
||||
|
||||
SafeNativeMethods.WorldSetAutoDisableFlag(world, false);
|
||||
UBOdeNative.WorldSetAutoDisableFlag(world, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -451,30 +451,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
maximumAngularVelocity = 0.49f * heartbeat *(float)Math.PI;
|
||||
maxAngVelocitySQ = maximumAngularVelocity * maximumAngularVelocity;
|
||||
|
||||
SafeNativeMethods.WorldSetCFM(world, commonContactCFM);
|
||||
SafeNativeMethods.WorldSetERP(world, commomContactERP);
|
||||
UBOdeNative.WorldSetCFM(world, commonContactCFM);
|
||||
UBOdeNative.WorldSetERP(world, commomContactERP);
|
||||
|
||||
SafeNativeMethods.WorldSetGravity(world, gravityx, gravityy, gravityz);
|
||||
UBOdeNative.WorldSetGravity(world, gravityx, gravityy, gravityz);
|
||||
|
||||
SafeNativeMethods.WorldSetLinearDamping(world, 0.001f);
|
||||
SafeNativeMethods.WorldSetAngularDamping(world, 0.002f);
|
||||
SafeNativeMethods.WorldSetAngularDampingThreshold(world, 0f);
|
||||
SafeNativeMethods.WorldSetLinearDampingThreshold(world, 0f);
|
||||
SafeNativeMethods.WorldSetMaxAngularSpeed(world, maximumAngularVelocity);
|
||||
UBOdeNative.WorldSetLinearDamping(world, 0.001f);
|
||||
UBOdeNative.WorldSetAngularDamping(world, 0.002f);
|
||||
UBOdeNative.WorldSetAngularDampingThreshold(world, 0f);
|
||||
UBOdeNative.WorldSetLinearDampingThreshold(world, 0f);
|
||||
UBOdeNative.WorldSetMaxAngularSpeed(world, maximumAngularVelocity);
|
||||
|
||||
SafeNativeMethods.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
||||
UBOdeNative.WorldSetQuickStepNumIterations(world, m_physicsiterations);
|
||||
|
||||
SafeNativeMethods.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
|
||||
SafeNativeMethods.WorldSetContactMaxCorrectingVel(world, 60.0f);
|
||||
UBOdeNative.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
|
||||
UBOdeNative.WorldSetContactMaxCorrectingVel(world, 60.0f);
|
||||
|
||||
HalfOdeStep = ODE_STEPSIZE * 0.5f;
|
||||
odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f);
|
||||
|
||||
m_contacts = new SafeNativeMethods.ContactGeom[contactsPerCollision];
|
||||
m_contacts = new UBOdeNative.ContactGeom[contactsPerCollision];
|
||||
m_contactsHandler = GCHandle.Alloc(m_contacts, GCHandleType.Pinned);
|
||||
ContactgeomsArray = m_contactsHandler.AddrOfPinnedObject();
|
||||
|
||||
GlobalContactsArray = Marshal.AllocHGlobal((maxContactJoints + 100) * SafeNativeMethods.Contact.unmanagedSizeOf);
|
||||
GlobalContactsArray = Marshal.AllocHGlobal((maxContactJoints + 100) * UBOdeNative.Contact.unmanagedSizeOf);
|
||||
|
||||
contactSharedForJoints.geom.g1 = IntPtr.Zero;
|
||||
contactSharedForJoints.geom.g2 = IntPtr.Zero;
|
||||
|
@ -536,7 +536,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
#region Collision Detection
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private IntPtr CreateContacJoint(ref SafeNativeMethods.ContactGeom contactGeom, bool smooth)
|
||||
private IntPtr CreateContacJoint(ref UBOdeNative.ContactGeom contactGeom, bool smooth)
|
||||
{
|
||||
if (ContactJointCount >= maxContactJoints)
|
||||
return IntPtr.Zero;
|
||||
|
@ -546,12 +546,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
contactSharedForJoints.geom.pos = contactGeom.pos;
|
||||
contactSharedForJoints.geom.normal = contactGeom.normal;
|
||||
|
||||
IntPtr contact = new IntPtr(GlobalContactsArray.ToInt64() + (Int64)(ContactJointCount * SafeNativeMethods.Contact.unmanagedSizeOf));
|
||||
IntPtr contact = new IntPtr(GlobalContactsArray.ToInt64() + (Int64)(ContactJointCount * UBOdeNative.Contact.unmanagedSizeOf));
|
||||
Marshal.StructureToPtr(contactSharedForJoints, contact, false);
|
||||
return SafeNativeMethods.JointCreateContactPtr(world, JointContactGroup, contact);
|
||||
return UBOdeNative.JointCreateContactPtr(world, JointContactGroup, contact);
|
||||
}
|
||||
|
||||
SafeNativeMethods.ContactGeom altWorkContact = new SafeNativeMethods.ContactGeom();
|
||||
UBOdeNative.ContactGeom altWorkContact = new UBOdeNative.ContactGeom();
|
||||
|
||||
/// <summary>
|
||||
/// This is our near callback. A geometry is near a body
|
||||
|
@ -571,14 +571,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
if (SafeNativeMethods.GeomIsSpace(g1) || SafeNativeMethods.GeomIsSpace(g2))
|
||||
if (UBOdeNative.GeomIsSpace(g1) || UBOdeNative.GeomIsSpace(g2))
|
||||
{
|
||||
// We'll be calling near recursivly if one
|
||||
// of them is a space to find all of the
|
||||
// contact points in the space
|
||||
try
|
||||
{
|
||||
SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, NearCallback);
|
||||
UBOdeNative.SpaceCollide2(g1, g2, IntPtr.Zero, NearCallback);
|
||||
}
|
||||
catch (AccessViolationException)
|
||||
{
|
||||
|
@ -594,14 +594,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
int count = 0;
|
||||
try
|
||||
{
|
||||
if (SafeNativeMethods.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc ||
|
||||
SafeNativeMethods.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc)
|
||||
if (UBOdeNative.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc ||
|
||||
UBOdeNative.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc)
|
||||
{
|
||||
int cflags = unchecked((int)(1 | SafeNativeMethods.CONTACTS_UNIMPORTANT));
|
||||
count = SafeNativeMethods.CollidePtr(g1, g2, cflags, ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
|
||||
int cflags = unchecked((int)(1 | UBOdeNative.CONTACTS_UNIMPORTANT));
|
||||
count = UBOdeNative.CollidePtr(g1, g2, cflags, ContactgeomsArray, UBOdeNative.ContactGeom.unmanagedSizeOf);
|
||||
}
|
||||
else
|
||||
count = SafeNativeMethods.CollidePtr(g1, g2, contactsPerCollision, ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
|
||||
count = UBOdeNative.CollidePtr(g1, g2, contactsPerCollision, ContactgeomsArray, UBOdeNative.ContactGeom.unmanagedSizeOf);
|
||||
}
|
||||
catch (SEHException)
|
||||
{
|
||||
|
@ -700,8 +700,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
//if (relVlenSQ > 0.01f)
|
||||
// mu *= frictionMovementMult;
|
||||
|
||||
if (SafeNativeMethods.GeomGetClass(g2) == SafeNativeMethods.GeomClassID.TriMeshClass &&
|
||||
SafeNativeMethods.GeomGetClass(g1) == SafeNativeMethods.GeomClassID.TriMeshClass)
|
||||
if (UBOdeNative.GeomGetClass(g2) == UBOdeNative.GeomClassID.TriMeshClass &&
|
||||
UBOdeNative.GeomGetClass(g1) == UBOdeNative.GeomClassID.TriMeshClass)
|
||||
smoothMesh = true;
|
||||
break;
|
||||
|
||||
|
@ -715,7 +715,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
// mu *= frictionMovementMult;
|
||||
p1.CollidingGround = true;
|
||||
|
||||
if (SafeNativeMethods.GeomGetClass(g1) == SafeNativeMethods.GeomClassID.TriMeshClass)
|
||||
if (UBOdeNative.GeomGetClass(g1) == UBOdeNative.GeomClassID.TriMeshClass)
|
||||
smoothMesh = true;
|
||||
break;
|
||||
|
||||
|
@ -741,7 +741,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
//if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f)
|
||||
// mu *= frictionMovementMult;
|
||||
|
||||
if (SafeNativeMethods.GeomGetClass(g2) == SafeNativeMethods.GeomClassID.TriMeshClass)
|
||||
if (UBOdeNative.GeomGetClass(g2) == UBOdeNative.GeomClassID.TriMeshClass)
|
||||
smoothMesh = true;
|
||||
}
|
||||
else
|
||||
|
@ -774,8 +774,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (dop1ava || dop2ava)
|
||||
smoothMesh = false;
|
||||
|
||||
IntPtr b1 = SafeNativeMethods.GeomGetBody(g1);
|
||||
IntPtr b2 = SafeNativeMethods.GeomGetBody(g2);
|
||||
IntPtr b1 = UBOdeNative.GeomGetBody(g1);
|
||||
IntPtr b2 = UBOdeNative.GeomGetBody(g2);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
|
@ -821,7 +821,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (Joint == IntPtr.Zero)
|
||||
break;
|
||||
|
||||
SafeNativeMethods.JointAttach(Joint, b1, b2);
|
||||
UBOdeNative.JointAttach(Joint, b1, b2);
|
||||
|
||||
ncontacts++;
|
||||
|
||||
|
@ -861,7 +861,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
int count = 0;
|
||||
try
|
||||
{
|
||||
count = SafeNativeMethods.CollidePtr(p1.collider, p2.collider, contactsPerCollision, ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
|
||||
count = UBOdeNative.CollidePtr(p1.collider, p2.collider, contactsPerCollision, ContactgeomsArray, UBOdeNative.ContactGeom.unmanagedSizeOf);
|
||||
}
|
||||
catch (SEHException)
|
||||
{
|
||||
|
@ -914,7 +914,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (Joint == IntPtr.Zero)
|
||||
break;
|
||||
|
||||
SafeNativeMethods.JointAttach(Joint, p1.Body, p2.Body);
|
||||
UBOdeNative.JointAttach(Joint, p1.Body, p2.Body);
|
||||
|
||||
ncontacts++;
|
||||
|
||||
|
@ -1054,8 +1054,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
if (chr.Body != IntPtr.Zero && chr.collider != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, NearCallback);
|
||||
SafeNativeMethods.SpaceCollide2(chr.collider, ActiveSpace, IntPtr.Zero, NearCallback);
|
||||
UBOdeNative.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, NearCallback);
|
||||
UBOdeNative.SpaceCollide2(chr.collider, ActiveSpace, IntPtr.Zero, NearCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1073,8 +1073,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
chr.CollidingObj = false;
|
||||
|
||||
// do colisions with static space
|
||||
SafeNativeMethods.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, NearCallback);
|
||||
SafeNativeMethods.SpaceCollide2(chr.collider, ActiveSpace, IntPtr.Zero, NearCallback);
|
||||
UBOdeNative.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, NearCallback);
|
||||
UBOdeNative.SpaceCollide2(chr.collider, ActiveSpace, IntPtr.Zero, NearCallback);
|
||||
|
||||
float mx = chr._AABB2D.minx;
|
||||
float Mx = chr._AABB2D.maxx;
|
||||
|
@ -1131,7 +1131,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
aprim.CollisionScore = 0;
|
||||
aprim.IsColliding = false;
|
||||
if(!aprim.m_outbounds && SafeNativeMethods.BodyIsEnabled(aprim.Body))
|
||||
if(!aprim.m_outbounds && UBOdeNative.BodyIsEnabled(aprim.Body))
|
||||
aprim.clearSleeperCollisions();
|
||||
}
|
||||
}
|
||||
|
@ -1142,11 +1142,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
foreach (OdePrim aprim in _activegroups)
|
||||
{
|
||||
if(!aprim.m_outbounds && SafeNativeMethods.BodyIsEnabled(aprim.Body) &&
|
||||
if(!aprim.m_outbounds && UBOdeNative.BodyIsEnabled(aprim.Body) &&
|
||||
aprim.m_collide_geom != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.SpaceCollide2(StaticSpace, aprim.m_collide_geom, IntPtr.Zero, NearCallback);
|
||||
SafeNativeMethods.SpaceCollide2(TerrainGeom, aprim.m_collide_geom, IntPtr.Zero, NearCallback);
|
||||
UBOdeNative.SpaceCollide2(StaticSpace, aprim.m_collide_geom, IntPtr.Zero, NearCallback);
|
||||
UBOdeNative.SpaceCollide2(TerrainGeom, aprim.m_collide_geom, IntPtr.Zero, NearCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1158,7 +1158,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
// colide active amoung them
|
||||
try
|
||||
{
|
||||
SafeNativeMethods.SpaceCollide(ActiveSpace, IntPtr.Zero, NearCallback);
|
||||
UBOdeNative.SpaceCollide(ActiveSpace, IntPtr.Zero, NearCallback);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1439,16 +1439,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
return StaticSpace;
|
||||
|
||||
// else remove it from its current space
|
||||
if (currentspace != IntPtr.Zero && SafeNativeMethods.SpaceQuery(currentspace, geom))
|
||||
if (currentspace != IntPtr.Zero && UBOdeNative.SpaceQuery(currentspace, geom))
|
||||
{
|
||||
if (SafeNativeMethods.GeomIsSpace(currentspace))
|
||||
if (UBOdeNative.GeomIsSpace(currentspace))
|
||||
{
|
||||
//waitForSpaceUnlock(currentspace);
|
||||
SafeNativeMethods.SpaceRemove(currentspace, geom);
|
||||
UBOdeNative.SpaceRemove(currentspace, geom);
|
||||
|
||||
if (SafeNativeMethods.SpaceGetSublevel(currentspace) > 2 && SafeNativeMethods.SpaceGetNumGeoms(currentspace) == 0)
|
||||
if (UBOdeNative.SpaceGetSublevel(currentspace) == 0 && UBOdeNative.SpaceGetNumGeoms(currentspace) == 0)
|
||||
{
|
||||
SafeNativeMethods.SpaceDestroy(currentspace);
|
||||
UBOdeNative.SpaceDestroy(currentspace);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1459,17 +1459,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
}
|
||||
else
|
||||
{
|
||||
currentspace = SafeNativeMethods.GeomGetSpace(geom);
|
||||
currentspace = UBOdeNative.GeomGetSpace(geom);
|
||||
if (currentspace != IntPtr.Zero)
|
||||
{
|
||||
if (SafeNativeMethods.GeomIsSpace(currentspace))
|
||||
if (UBOdeNative.GeomIsSpace(currentspace))
|
||||
{
|
||||
//waitForSpaceUnlock(currentspace);
|
||||
SafeNativeMethods.SpaceRemove(currentspace, geom);
|
||||
UBOdeNative.SpaceRemove(currentspace, geom);
|
||||
|
||||
if (SafeNativeMethods.SpaceGetSublevel(currentspace) > 2 && SafeNativeMethods.SpaceGetNumGeoms(currentspace) == 0)
|
||||
if (UBOdeNative.SpaceGetSublevel(currentspace) == 0 && UBOdeNative.SpaceGetNumGeoms(currentspace) == 0)
|
||||
{
|
||||
SafeNativeMethods.SpaceDestroy(currentspace);
|
||||
UBOdeNative.SpaceDestroy(currentspace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1477,10 +1477,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
// put the geom in the newspace
|
||||
//waitForSpaceUnlock(StaticSpace);
|
||||
if(SafeNativeMethods.SpaceQuery(StaticSpace, geom))
|
||||
if(UBOdeNative.SpaceQuery(StaticSpace, geom))
|
||||
m_log.Info("[Physics]: 'MoveGeomToStaticSpace' geom already in static space:" + geom);
|
||||
else
|
||||
SafeNativeMethods.SpaceAdd(StaticSpace, geom);
|
||||
UBOdeNative.SpaceAdd(StaticSpace, geom);
|
||||
|
||||
return StaticSpace;
|
||||
}
|
||||
|
@ -1529,7 +1529,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
m_log.InfoFormat("[ubOde] start processing pending actor operations");
|
||||
int tstart = Util.EnvironmentTickCount();
|
||||
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
UBOdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
while (ChangesQueue.TryDequeue(out ODEchangeitem item))
|
||||
{
|
||||
|
@ -1615,7 +1615,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
//double rayTime = 0;
|
||||
|
||||
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
UBOdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
while (ChangesQueue.TryDequeue(out ODEchangeitem item))
|
||||
{
|
||||
|
@ -1709,7 +1709,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
{
|
||||
if(pobj.Body != IntPtr.Zero && !pobj.m_isSelected &&
|
||||
!pobj.m_disabled && !pobj.m_building &&
|
||||
!SafeNativeMethods.BodyIsEnabled(pobj.Body))
|
||||
!UBOdeNative.BodyIsEnabled(pobj.Body))
|
||||
sleepers.Add(pobj);
|
||||
}
|
||||
}
|
||||
|
@ -1727,8 +1727,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
// do a ode simulation step
|
||||
lock (SimulationLock)
|
||||
{
|
||||
SafeNativeMethods.WorldQuickStep(world, ODE_STEPSIZE);
|
||||
SafeNativeMethods.JointGroupEmpty(JointContactGroup);
|
||||
UBOdeNative.WorldQuickStep(world, ODE_STEPSIZE);
|
||||
UBOdeNative.JointGroupEmpty(JointContactGroup);
|
||||
}
|
||||
//qstepTIme += Util.GetTimeStampMS() - tmpTime;
|
||||
|
||||
|
@ -2042,12 +2042,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
lock(SimulationLock)
|
||||
lock (OdeLock)
|
||||
{
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
UBOdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
if (TerrainGeom != IntPtr.Zero)
|
||||
{
|
||||
actor_name_map.Remove(TerrainGeom);
|
||||
SafeNativeMethods.GeomDestroy(TerrainGeom);
|
||||
UBOdeNative.GeomDestroy(TerrainGeom);
|
||||
}
|
||||
|
||||
if (m_terrainHeightsHandler.IsAllocated)
|
||||
|
@ -2063,16 +2063,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
m_lastRegionWidth = m_regionWidth;
|
||||
m_lastRegionHeight = m_regionHeight;
|
||||
|
||||
HeightmapData = SafeNativeMethods.GeomOSTerrainDataCreate();
|
||||
SafeNativeMethods.GeomOSTerrainDataBuild(HeightmapData, m_terrainHeightsHandler.AddrOfPinnedObject(), 0, 1.0f,
|
||||
HeightmapData = UBOdeNative.GeomOSTerrainDataCreate();
|
||||
UBOdeNative.GeomOSTerrainDataBuild(HeightmapData, m_terrainHeightsHandler.AddrOfPinnedObject(), 0, 1.0f,
|
||||
m_heightmapWidthSamples, m_heightmapHeightSamples,
|
||||
1, 0);
|
||||
|
||||
TerrainGeom = SafeNativeMethods.CreateOSTerrain(TopSpace, HeightmapData, 1);
|
||||
TerrainGeom = UBOdeNative.CreateOSTerrain(TopSpace, HeightmapData, 1);
|
||||
if (TerrainGeom != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land));
|
||||
SafeNativeMethods.GeomSetCollideBits(TerrainGeom, 0);
|
||||
UBOdeNative.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land));
|
||||
UBOdeNative.GeomSetCollideBits(TerrainGeom, 0);
|
||||
|
||||
PhysicsActor pa = new NullPhysicsActor();
|
||||
pa.Name = "Terrain";
|
||||
|
@ -2081,7 +2081,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
//geom_name_map[GroundGeom] = "Terrain";
|
||||
|
||||
SafeNativeMethods.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f);
|
||||
UBOdeNative.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f);
|
||||
}
|
||||
else
|
||||
m_terrainHeightsHandler.Free();
|
||||
|
@ -2147,8 +2147,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
lock(SimulationLock)
|
||||
lock (OdeLock)
|
||||
{
|
||||
SafeNativeMethods.GeomOSTerrainDataSetBounds(HeightmapData, minH, maxH);
|
||||
SafeNativeMethods.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f);
|
||||
UBOdeNative.GeomOSTerrainDataSetBounds(HeightmapData, minH, maxH);
|
||||
UBOdeNative.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2169,7 +2169,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
if (world == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
SafeNativeMethods.AllocateODEDataForThread(~0U);
|
||||
UBOdeNative.AllocateODEDataForThread(~0U);
|
||||
|
||||
if (m_meshWorker != null)
|
||||
m_meshWorker.Stop();
|
||||
|
@ -2202,7 +2202,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
if (TerrainGeom != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.GeomDestroy(TerrainGeom);
|
||||
UBOdeNative.GeomDestroy(TerrainGeom);
|
||||
TerrainGeom = IntPtr.Zero;
|
||||
}
|
||||
|
||||
|
@ -2222,7 +2222,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
GlobalContactsArray = IntPtr.Zero;
|
||||
}
|
||||
|
||||
SafeNativeMethods.WorldDestroy(world);
|
||||
UBOdeNative.WorldDestroy(world);
|
||||
world = IntPtr.Zero;
|
||||
//d.CloseODE();
|
||||
}
|
||||
|
@ -2354,7 +2354,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
lock (SyncObject)
|
||||
{
|
||||
m_rayCastManager.QueueRequest(req);
|
||||
if (!Monitor.Wait(SyncObject, 10000))
|
||||
if (!Monitor.Wait(SyncObject, 500))
|
||||
return null;
|
||||
else
|
||||
return ourresults;
|
||||
|
|
|
@ -72,8 +72,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
IntPtr geom = ((OdePrim)actor).m_prim_geom;
|
||||
|
||||
Vector3 geopos = SafeNativeMethods.GeomGetPositionOMV(geom);
|
||||
Quaternion geomOri = SafeNativeMethods.GeomGetQuaternionOMV(geom);
|
||||
Vector3 geopos = UBOdeNative.GeomGetPositionOMV(geom);
|
||||
Quaternion geomOri = UBOdeNative.GeomGetQuaternionOMV(geom);
|
||||
|
||||
//Vector3 geopos = actor.Position;
|
||||
//Quaternion geomOri = actor.Orientation;
|
||||
|
@ -116,11 +116,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
|||
|
||||
offset = rayResults[0].Pos - geopos;
|
||||
|
||||
SafeNativeMethods.GeomClassID geoclass = SafeNativeMethods.GeomGetClass(geom);
|
||||
UBOdeNative.GeomClassID geoclass = UBOdeNative.GeomGetClass(geom);
|
||||
|
||||
if (geoclass == SafeNativeMethods.GeomClassID.SphereClass)
|
||||
if (geoclass == UBOdeNative.GeomClassID.SphereClass)
|
||||
{
|
||||
float r = SafeNativeMethods.GeomSphereGetRadius(geom);
|
||||
float r = UBOdeNative.GeomSphereGetRadius(geom);
|
||||
|
||||
offset.Normalize();
|
||||
offset *= r;
|
||||
|
|
|
@ -53,6 +53,7 @@ using System.Drawing;
|
|||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
|
@ -655,14 +656,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
|
||||
public List<ScenePresence> GetLinkAvatars(int linkType)
|
||||
{
|
||||
if (m_host == null)
|
||||
return new List<ScenePresence>();
|
||||
|
||||
return GetLinkAvatars(linkType, m_host.ParentGroup);
|
||||
|
||||
}
|
||||
|
||||
public List<ScenePresence> GetLinkAvatars(int linkType, SceneObjectGroup sog)
|
||||
{
|
||||
List<ScenePresence> ret = new List<ScenePresence>();
|
||||
if (m_host == null || m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
|
||||
if (sog == null || sog.IsDeleted)
|
||||
return ret;
|
||||
|
||||
// List<ScenePresence> avs = m_host.ParentGroup.GetLinkedAvatars();
|
||||
// this needs check
|
||||
List<ScenePresence> avs = m_host.ParentGroup.GetSittingAvatars();
|
||||
List<ScenePresence> avs = sog.GetSittingAvatars();
|
||||
switch (linkType)
|
||||
{
|
||||
case ScriptBaseClass.LINK_SET:
|
||||
|
@ -684,15 +692,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (linkType < 0)
|
||||
return ret;
|
||||
|
||||
int partCount = m_host.ParentGroup.GetPartCount();
|
||||
int partCount = sog.GetPartCount();
|
||||
|
||||
if (linkType <= partCount)
|
||||
linkType -= partCount;
|
||||
if (linkType <= 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
linkType = linkType - partCount;
|
||||
if (linkType > avs.Count)
|
||||
{
|
||||
return ret;
|
||||
|
@ -3845,6 +3853,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
|
||||
return;
|
||||
|
||||
UUID permsgranter = m_item.PermsGranter;
|
||||
int permsmask = m_item.PermsMask;
|
||||
|
||||
grp.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId);
|
||||
|
||||
if (World.Permissions.PropagatePermissions())
|
||||
|
@ -3858,6 +3869,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
grp.InvalidateEffectivePerms();
|
||||
}
|
||||
|
||||
m_item.PermsMask = permsmask;
|
||||
m_item.PermsGranter = permsgranter;
|
||||
|
||||
grp.RootPart.ObjectSaleType = 0;
|
||||
grp.RootPart.SalePrice = 10;
|
||||
|
||||
|
@ -4638,28 +4652,70 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
public LSL_Key llGetLinkKey(int linknum)
|
||||
{
|
||||
if(linknum < 0)
|
||||
if (linknum < 0)
|
||||
{
|
||||
if (linknum == ScriptBaseClass.LINK_THIS)
|
||||
return m_host.UUID.ToString();
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
|
||||
SceneObjectGroup sog = m_host.ParentGroup;
|
||||
if (linknum < 2)
|
||||
return m_host.ParentGroup.RootPart.UUID.ToString();
|
||||
return sog.RootPart.UUID.ToString();
|
||||
|
||||
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum);
|
||||
SceneObjectPart part = sog.GetLinkNumPart(linknum);
|
||||
if (part != null)
|
||||
{
|
||||
return part.UUID.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (linknum > m_host.ParentGroup.PrimCount)
|
||||
if (linknum > sog.PrimCount)
|
||||
{
|
||||
linknum -= m_host.ParentGroup.PrimCount + 1;
|
||||
linknum -= sog.PrimCount + 1;
|
||||
|
||||
List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET);
|
||||
List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET, sog);
|
||||
if (avatars.Count > linknum)
|
||||
{
|
||||
return avatars[linknum].UUID.ToString();
|
||||
}
|
||||
}
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum)
|
||||
{
|
||||
if(!UUID.TryParse(objectid, out UUID oID))
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
|
||||
if (!World.TryGetSceneObjectPart(oID, out SceneObjectPart sop))
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
|
||||
if (linknum < 0)
|
||||
{
|
||||
if (linknum == ScriptBaseClass.LINK_THIS)
|
||||
return sop.UUID.ToString();
|
||||
return ScriptBaseClass.NULL_KEY;
|
||||
}
|
||||
|
||||
SceneObjectGroup sog = sop.ParentGroup;
|
||||
|
||||
if (linknum < 2)
|
||||
return sog.RootPart.UUID.ToString();
|
||||
|
||||
SceneObjectPart part = sog.GetLinkNumPart(linknum);
|
||||
if (part != null)
|
||||
{
|
||||
return part.UUID.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (linknum > sog.PrimCount)
|
||||
{
|
||||
linknum -= sog.PrimCount + 1;
|
||||
|
||||
List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET, sog);
|
||||
if (avatars.Count > linknum)
|
||||
{
|
||||
return avatars[linknum].UUID.ToString();
|
||||
|
@ -8199,6 +8255,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return Util.SHA1Hash(src, Encoding.UTF8).ToLower();
|
||||
}
|
||||
|
||||
public LSL_String llSHA256String(LSL_String input)
|
||||
{
|
||||
// Create a SHA256
|
||||
using (SHA256 sha256Hash = SHA256.Create())
|
||||
{
|
||||
// ComputeHash - returns byte array
|
||||
byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
|
||||
return Util.bytesToHexString(bytes, true);
|
||||
}
|
||||
}
|
||||
|
||||
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
|
||||
{
|
||||
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
|
||||
|
@ -14754,21 +14821,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_VELOCITY:
|
||||
Vector3 vel = Vector3.Zero;
|
||||
Vector3 vel;
|
||||
|
||||
if (obj.ParentGroup.IsAttachment)
|
||||
{
|
||||
ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
|
||||
|
||||
if (sp != null)
|
||||
vel = sp.GetWorldVelocity();
|
||||
vel = sp != null ? sp.GetWorldVelocity() : Vector3.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = obj.Velocity;
|
||||
}
|
||||
|
||||
ret.Add(vel);
|
||||
ret.Add(new LSL_Vector(vel));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_OWNER:
|
||||
ret.Add(new LSL_String(obj.OwnerID.ToString()));
|
||||
|
|
|
@ -2201,7 +2201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if(sceneOG.IsAttachment)
|
||||
return;
|
||||
|
||||
if (sceneOG.OwnerID != m_host.OwnerID)
|
||||
if (sceneOG.OwnerID.NotEqual(m_host.OwnerID))
|
||||
return;
|
||||
|
||||
// harakiri check
|
||||
|
@ -4249,38 +4249,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public void ForceAttachToAvatarFromInventory(UUID avatarId, string itemName, int attachmentPoint)
|
||||
{
|
||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||
|
||||
if (attachmentsModule == null)
|
||||
if (attachmentsModule is null)
|
||||
return;
|
||||
|
||||
InitLSL();
|
||||
|
||||
TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
m_LSL_Api.llSay(0, string.Format("Could not find object '{0}'", itemName));
|
||||
m_LSL_Api?.llSay(0, string.Format("Could not find object '{0}'", itemName));
|
||||
throw new Exception(String.Format("The inventory item '{0}' could not be found", itemName));
|
||||
}
|
||||
|
||||
if (item.InvType != (int)InventoryType.Object)
|
||||
{
|
||||
// FIXME: Temporary null check for regression tests since they dont' have the infrastructure to set
|
||||
// up the api reference.
|
||||
if (m_LSL_Api != null)
|
||||
m_LSL_Api.llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName));
|
||||
|
||||
m_LSL_Api?.llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName));
|
||||
throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName));
|
||||
}
|
||||
|
||||
ScenePresence sp = World.GetScenePresence(avatarId);
|
||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) != 0)
|
||||
{
|
||||
m_LSL_Api?.llSay(0, string.Format("Unable to attach coalesced object, item '{0}' ", itemName));
|
||||
throw new Exception(String.Format("The inventory item '{0}' is a coalesced object", itemName));
|
||||
}
|
||||
|
||||
if (sp == null)
|
||||
ScenePresence sp = World.GetScenePresence(avatarId);
|
||||
if (sp is null)
|
||||
return;
|
||||
|
||||
InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID, out string message);
|
||||
|
||||
if (newItem == null)
|
||||
if (newItem is null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}",
|
||||
|
|
|
@ -153,6 +153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
LSL_Key llGetKey();
|
||||
LSL_Key llGetLandOwnerAt(LSL_Vector pos);
|
||||
LSL_Key llGetLinkKey(int linknum);
|
||||
LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum);
|
||||
LSL_String llGetLinkName(int linknum);
|
||||
LSL_Integer llGetLinkNumber();
|
||||
LSL_Integer llGetLinkNumberOfSides(int link);
|
||||
|
@ -273,6 +274,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
void llMapDestination(string simname, LSL_Vector pos, LSL_Vector look_at);
|
||||
LSL_String llMD5String(string src, int nonce);
|
||||
LSL_String llSHA1String(string src);
|
||||
LSL_String llSHA256String(LSL_String src);
|
||||
void llMessageLinked(int linknum, int num, string str, string id);
|
||||
void llMinEventDelay(double delay);
|
||||
void llModifyLand(int action, int brush);
|
||||
|
|
|
@ -563,6 +563,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
return m_LSL_Functions.llGetLinkKey(linknum);
|
||||
}
|
||||
|
||||
public LSL_Key llObjectGetLinkKey(LSL_Key objectid, int linknum)
|
||||
{
|
||||
return m_LSL_Functions.llObjectGetLinkKey(objectid, linknum); ;
|
||||
}
|
||||
|
||||
public LSL_String llGetLinkName(int linknum)
|
||||
{
|
||||
return m_LSL_Functions.llGetLinkName(linknum);
|
||||
|
@ -1153,6 +1158,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
return m_LSL_Functions.llSHA1String(src);
|
||||
}
|
||||
|
||||
public LSL_String llSHA256String(LSL_String src)
|
||||
{
|
||||
return m_LSL_Functions.llSHA256String(src);
|
||||
}
|
||||
|
||||
public void llMessageLinked(int linknum, int num, string str, string id)
|
||||
{
|
||||
m_LSL_Functions.llMessageLinked(linknum, num, str, id);
|
||||
|
|
|
@ -59,9 +59,9 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
|
||||
public Vector3(Vector3 vector)
|
||||
{
|
||||
x = (float)vector.x;
|
||||
y = (float)vector.y;
|
||||
z = (float)vector.z;
|
||||
x = vector.x;
|
||||
y = vector.y;
|
||||
z = vector.z;
|
||||
}
|
||||
|
||||
public Vector3(OMV_Vector3 vector)
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace OpenSim.Services.InventoryService.Tests
|
|||
string itemName3 = "item3";
|
||||
|
||||
itemToStore.CreatorIdentification = creatorId2.ToString();
|
||||
itemToStore.Owner = ownerId2;
|
||||
//itemToStore.Owner = ownerId2; this cant be done
|
||||
itemToStore.Folder = folderId2;
|
||||
itemToStore.InvType = invType2;
|
||||
itemToStore.AssetType = assetType2;
|
||||
|
|
|
@ -297,6 +297,10 @@ namespace OpenSim.Services.InventoryService
|
|||
inventory.Folders = new List<InventoryFolderBase>();
|
||||
inventory.Items = new List<InventoryItemBase>();
|
||||
|
||||
InventoryFolderBase f = GetFolder(principalID, folderID);
|
||||
if (f == null)
|
||||
return inventory;
|
||||
|
||||
XInventoryFolder[] folders = m_Database.GetFolders(
|
||||
new string[] { "parentFolderID"},
|
||||
new string[] { folderID.ToString() });
|
||||
|
@ -317,12 +321,8 @@ namespace OpenSim.Services.InventoryService
|
|||
inventory.Items.Add(ConvertToOpenSim(i));
|
||||
}
|
||||
|
||||
InventoryFolderBase f = GetFolder(principalID, folderID);
|
||||
if (f != null)
|
||||
{
|
||||
inventory.Version = f.Version;
|
||||
inventory.OwnerID = f.Owner;
|
||||
}
|
||||
inventory.Version = f.Version;
|
||||
inventory.OwnerID = f.Owner;
|
||||
inventory.FolderID = folderID;
|
||||
|
||||
return inventory;
|
||||
|
@ -562,12 +562,20 @@ namespace OpenSim.Services.InventoryService
|
|||
{
|
||||
// Principal is b0rked. *sigh*
|
||||
//
|
||||
foreach (InventoryItemBase i in items)
|
||||
int len = items.Count;
|
||||
if(len == 0)
|
||||
return false;
|
||||
string[] ids = new string[len];
|
||||
string[] folders = new string[len];
|
||||
int i=0;
|
||||
foreach (InventoryItemBase it in items)
|
||||
{
|
||||
m_Database.MoveItem(i.ID.ToString(), i.Folder.ToString());
|
||||
ids[i] = it.ID.ToString();
|
||||
folders[i++] = it.Folder.ToString();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
return m_Database.MoveItems(ids, folders);
|
||||
}
|
||||
|
||||
public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
|
||||
|
@ -594,18 +602,39 @@ namespace OpenSim.Services.InventoryService
|
|||
{
|
||||
// Just use the ID... *facepalms*
|
||||
//
|
||||
foreach (UUID id in itemIDs)
|
||||
m_Database.DeleteItems("inventoryID", id.ToString());
|
||||
if(principalID.IsZero())
|
||||
{
|
||||
foreach (UUID id in itemIDs)
|
||||
m_Database.DeleteItems("inventoryID", id.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
string u = principalID.ToString();
|
||||
string[] fields = new string[] { "avatarID", "inventoryID" };
|
||||
foreach (UUID id in itemIDs)
|
||||
m_Database.DeleteItems(
|
||||
fields,
|
||||
new string[] { u, id.ToString()});
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual InventoryItemBase GetItem(UUID principalID, UUID itemID)
|
||||
{
|
||||
XInventoryItem[] items = m_Database.GetItems(
|
||||
XInventoryItem[] items;
|
||||
if (principalID.IsZero())
|
||||
{
|
||||
items = m_Database.GetItems(
|
||||
new string[] { "inventoryID" },
|
||||
new string[] { itemID.ToString() });
|
||||
}
|
||||
else
|
||||
{
|
||||
items = m_Database.GetItems(
|
||||
new string[] { "avatarID", "inventoryID" },
|
||||
new string[] { principalID.ToString(), itemID.ToString() });
|
||||
}
|
||||
|
||||
if (items.Length == 0)
|
||||
return null;
|
||||
|
@ -615,19 +644,63 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public virtual InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] ids)
|
||||
{
|
||||
InventoryItemBase[] items = new InventoryItemBase[ids.Length];
|
||||
int i = 0;
|
||||
foreach (UUID id in ids)
|
||||
items[i++] = GetItem(userID, id);
|
||||
int len = ids.Length;
|
||||
if(len == 0)
|
||||
return new InventoryItemBase[0];
|
||||
|
||||
string[] sids = new string[len];
|
||||
|
||||
int i;
|
||||
for(i = 0; i< len; ++i)
|
||||
sids[i] = ids[i].ToString();
|
||||
|
||||
XInventoryItem[] xits = m_Database.GetItems("inventoryID", sids);
|
||||
sids = null;
|
||||
|
||||
len = xits.Length;
|
||||
InventoryItemBase[] items = new InventoryItemBase[len];
|
||||
i = 0;
|
||||
|
||||
if(userID.IsZero())
|
||||
{
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
if (xits[i] == null)
|
||||
items[i] = null;
|
||||
else
|
||||
items[i] = ConvertToOpenSim(xits[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
if (xits[i] == null)
|
||||
items[i] = null;
|
||||
else if (xits[i].avatarID.Equals(userID))
|
||||
items[i] = ConvertToOpenSim(xits[i]);
|
||||
else
|
||||
items[i] = null;
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public virtual InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
|
||||
{
|
||||
XInventoryFolder[] folders = m_Database.GetFolders(
|
||||
new string[] { "folderID"},
|
||||
XInventoryFolder[] folders;
|
||||
if(principalID.IsZero())
|
||||
{
|
||||
folders = m_Database.GetFolders(
|
||||
new string[] { "folderID" },
|
||||
new string[] { folderID.ToString() });
|
||||
}
|
||||
else
|
||||
{
|
||||
folders = m_Database.GetFolders(
|
||||
new string[] { "agentID", "folderID" },
|
||||
new string[] { principalID.ToString(), folderID.ToString() });
|
||||
}
|
||||
|
||||
if (folders.Length == 0)
|
||||
return null;
|
||||
|
|
|
@ -44,6 +44,36 @@ namespace OpenSim.Tests.Common
|
|||
|
||||
public TestXInventoryDataPlugin(string conn, string realm) {}
|
||||
|
||||
public XInventoryItem[] GetItems(string field, string val)
|
||||
{
|
||||
// Console.WriteLine(
|
||||
// "Requesting items, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
|
||||
|
||||
List<XInventoryItem> origItems = Get<XInventoryItem>(field, val, m_allItems.Values.ToList());
|
||||
|
||||
XInventoryItem[] items = origItems.Select(i => i.Clone()).ToArray();
|
||||
|
||||
// Console.WriteLine("Found {0} items", items.Length);
|
||||
// Array.ForEach(items, i => Console.WriteLine("Found item {0} {1}", i.inventoryName, i.inventoryID));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetItems(string field, string[] vals)
|
||||
{
|
||||
// Console.WriteLine(
|
||||
// "Requesting items, fields {0}, vals {1}", string.Join(", ", fields), string.Join(", ", vals));
|
||||
|
||||
List<XInventoryItem> origItems = Get<XInventoryItem>(field, vals, m_allItems.Values.ToList());
|
||||
|
||||
XInventoryItem[] items = origItems.Select(i => i.Clone()).ToArray();
|
||||
|
||||
// Console.WriteLine("Found {0} items", items.Length);
|
||||
// Array.ForEach(items, i => Console.WriteLine("Found item {0} {1}", i.inventoryName, i.inventoryID));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetItems(string[] fields, string[] vals)
|
||||
{
|
||||
// Console.WriteLine(
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<configuration>
|
||||
<dllmap os="osx" dll="ode" target="lib64/libode.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="ode" target="lib64/libode-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="ode" target="lib32/libode" />
|
||||
<dllmap os="!windows,osx" cpu="ppc64" dll="ode" target="lib64/libode-ppc64" />
|
||||
<dllmap os="!windows,osx" cpu="s390x" dll="ode" target="lib64/libode-s390x" />
|
||||
<dllmap os="osx" dll="ubode" target="lib64/libubode.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="ubode" target="lib64/libubode-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="ubode" target="lib32/libubode" />
|
||||
</configuration>
|
||||
|
|
|
@ -275,6 +275,10 @@
|
|||
;ConnectionString = ""
|
||||
;Realm = "fsassets"
|
||||
|
||||
;; FSAssets uses a folder structure to reduce file access times. By default that structure is 00/00/00
|
||||
;; Setting this to true will switch to an older 000/000 format, which can cause issues with long file lists
|
||||
;UseOsgridFormat = false
|
||||
|
||||
;; The following are common to both the default asset service and FSAsset service
|
||||
|
||||
;; Common asset service options
|
||||
|
|
|
@ -230,6 +230,10 @@
|
|||
;ConnectionString = ""
|
||||
;Realm = "fsassets"
|
||||
|
||||
;; FSAssets uses a folder structure to reduce file access times. By default that structure is 00/00/00
|
||||
;; Setting this to true will switch to an older 000/000 format, which can cause issues with long file lists
|
||||
;UseOsgridFormat = false
|
||||
|
||||
;; The following are common to both the default asset service and FSAsset service
|
||||
|
||||
;; Common asset service options
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
3547fa45-79ff-dc5f-a2ba-b9ffb56abefe
|
||||
62cb3537-38d5-c11b-1a4e-8b1336a4015f
|
||||
<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>
|
||||
<key>controls</key>
|
||||
<map>
|
||||
|
@ -5157,6 +5157,14 @@
|
|||
<map><key>name</key><map><key>type</key><string>string</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>llObjectGetLinkKey</key>
|
||||
<map>
|
||||
<key>return</key><string>key</string>
|
||||
<key>arguments</key><array>
|
||||
<map><key>objectid</key><map><key>type</key><string>key</string></map></map>
|
||||
<map><key>linknum</key><map><key>type</key><string>integer</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>llOffsetTexture</key>
|
||||
<map>
|
||||
<key>arguments</key><array>
|
||||
|
@ -6053,6 +6061,13 @@
|
|||
<map><key>src</key><map><key>type</key><string>string</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>llSHA256String</key>
|
||||
<map>
|
||||
<key>return</key><string>string</string>
|
||||
<key>arguments</key><array>
|
||||
<map><key>src</key><map><key>type</key><string>string</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>llShout</key>
|
||||
<map>
|
||||
<key>arguments</key><array>
|
||||
|
@ -6422,6 +6437,7 @@
|
|||
<key>arguments</key><array>
|
||||
<map><key>agentId</key><map><key>type</key><string>key</string></map></map>
|
||||
<map><key>notecard</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>includeHuds</key><map><key>type</key><string>integer</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osAgentSaveAppearance</key>
|
||||
|
@ -6430,7 +6446,6 @@
|
|||
<key>arguments</key><array>
|
||||
<map><key>agentId</key><map><key>type</key><string>key</string></map></map>
|
||||
<map><key>notecard</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>includeHuds</key><map><key>type</key><string>integer</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osAngleBetween</key>
|
||||
|
@ -6447,7 +6462,6 @@
|
|||
<key>arguments</key><array>
|
||||
<map><key>a</key><map><key>type</key><string>float</string></map></map>
|
||||
<map><key>b</key><map><key>type</key><string>float</string></map></map>
|
||||
<map><key>margin</key><map><key>type</key><string>float</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osApproxEquals</key>
|
||||
|
@ -6456,6 +6470,7 @@
|
|||
<key>arguments</key><array>
|
||||
<map><key>a</key><map><key>type</key><string>float</string></map></map>
|
||||
<map><key>b</key><map><key>type</key><string>float</string></map></map>
|
||||
<map><key>margin</key><map><key>type</key><string>float</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osApproxEquals</key>
|
||||
|
@ -7174,15 +7189,15 @@
|
|||
<key>osKickAvatar</key>
|
||||
<map>
|
||||
<key>arguments</key><array>
|
||||
<map><key>FirstName</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>SurName</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>agentId</key><map><key>type</key><string>key</string></map></map>
|
||||
<map><key>alert</key><map><key>type</key><string>string</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osKickAvatar</key>
|
||||
<map>
|
||||
<key>arguments</key><array>
|
||||
<map><key>agentId</key><map><key>type</key><string>key</string></map></map>
|
||||
<map><key>FirstName</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>SurName</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>alert</key><map><key>type</key><string>string</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
|
@ -8004,19 +8019,19 @@
|
|||
</map>
|
||||
<key>osSlerp</key>
|
||||
<map>
|
||||
<key>return</key><string>vector</string>
|
||||
<key>return</key><string>rotation</string>
|
||||
<key>arguments</key><array>
|
||||
<map><key>a</key><map><key>type</key><string>vector</string></map></map>
|
||||
<map><key>b</key><map><key>type</key><string>vector</string></map></map>
|
||||
<map><key>a</key><map><key>type</key><string>rotation</string></map></map>
|
||||
<map><key>b</key><map><key>type</key><string>rotation</string></map></map>
|
||||
<map><key>amount</key><map><key>type</key><string>float</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osSlerp</key>
|
||||
<map>
|
||||
<key>return</key><string>rotation</string>
|
||||
<key>return</key><string>vector</string>
|
||||
<key>arguments</key><array>
|
||||
<map><key>a</key><map><key>type</key><string>rotation</string></map></map>
|
||||
<map><key>b</key><map><key>type</key><string>rotation</string></map></map>
|
||||
<map><key>a</key><map><key>type</key><string>vector</string></map></map>
|
||||
<map><key>b</key><map><key>type</key><string>vector</string></map></map>
|
||||
<map><key>amount</key><map><key>type</key><string>float</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
|
@ -8041,10 +8056,21 @@
|
|||
<key>arguments</key><array>
|
||||
<map><key>src</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>value</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>start</key><map><key>type</key><string>integer</string></map></map>
|
||||
<map><key>count</key><map><key>type</key><string>integer</string></map></map>
|
||||
<map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osStringIndexOf</key>
|
||||
<map>
|
||||
<key>return</key><string>integer</string>
|
||||
<key>arguments</key><array>
|
||||
<map><key>src</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>value</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osStringLastIndexOf</key>
|
||||
<map>
|
||||
<key>return</key><string>integer</string>
|
||||
<key>arguments</key><array>
|
||||
|
@ -8064,15 +8090,11 @@
|
|||
<map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osStringLastIndexOf</key>
|
||||
<key>osStringLength</key>
|
||||
<map>
|
||||
<key>return</key><string>integer</string>
|
||||
<key>arguments</key><array>
|
||||
<map><key>src</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>value</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>start</key><map><key>type</key><string>integer</string></map></map>
|
||||
<map><key>count</key><map><key>type</key><string>integer</string></map></map>
|
||||
<map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map>
|
||||
<map><key>s</key><map><key>type</key><string>string</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osStringRemove</key>
|
||||
|
@ -8119,6 +8141,14 @@
|
|||
<map><key>start</key><map><key>type</key><string>integer</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osSubStringIndex</key>
|
||||
<map>
|
||||
<key>return</key><string>integer</string>
|
||||
<key>arguments</key><array>
|
||||
<map><key>source</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>pattern</key><map><key>type</key><string>string</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osSunGetParam</key>
|
||||
<map>
|
||||
<key>return</key><string>float</string>
|
||||
|
@ -8134,6 +8164,14 @@
|
|||
</array>
|
||||
</map>
|
||||
<key>osTeleportAgent</key>
|
||||
<map>
|
||||
<key>arguments</key><array>
|
||||
<map><key>agent</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>position</key><map><key>type</key><string>vector</string></map></map>
|
||||
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osTeleportAgent</key>
|
||||
<map>
|
||||
<key>arguments</key><array>
|
||||
<map><key>agent</key><map><key>type</key><string>string</string></map></map>
|
||||
|
@ -8152,14 +8190,6 @@
|
|||
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osTeleportAgent</key>
|
||||
<map>
|
||||
<key>arguments</key><array>
|
||||
<map><key>agent</key><map><key>type</key><string>string</string></map></map>
|
||||
<map><key>position</key><map><key>type</key><string>vector</string></map></map>
|
||||
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
|
||||
</array>
|
||||
</map>
|
||||
<key>osTeleportObject</key>
|
||||
<map>
|
||||
<key>return</key><string>integer</string>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue