mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
update libomv adding NotEqual to vectors and quats; more cosmtics on ubode
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -153,7 +153,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
public ODEDynamics(OdePrim rootp)
|
||||
{
|
||||
rootPrim = rootp;
|
||||
_pParentScene = rootPrim._parent_scene;
|
||||
_pParentScene = rootPrim.m_parentScene;
|
||||
m_timestep = _pParentScene.ODE_STEPSIZE;
|
||||
m_invtimestep = 1.0f / m_timestep;
|
||||
m_gravmod = rootPrim.GravModifier;
|
||||
@@ -853,10 +853,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
}
|
||||
|
||||
// hover
|
||||
if (m_VhoverTimescale < 300 && rootPrim.prim_geom != IntPtr.Zero)
|
||||
if (m_VhoverTimescale < 300 && rootPrim.m_prim_geom != IntPtr.Zero)
|
||||
{
|
||||
// d.Vector3 pos = d.BodyGetPosition(Body);
|
||||
SafeNativeMethods.Vector3 pos = SafeNativeMethods.GeomGetPosition(rootPrim.prim_geom);
|
||||
SafeNativeMethods.Vector3 pos = SafeNativeMethods.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);
|
||||
@@ -997,10 +997,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
|
||||
float broll = effroll;
|
||||
/*
|
||||
if (broll > halfpi)
|
||||
broll = pi - broll;
|
||||
else if (broll < -halfpi)
|
||||
broll = -pi - broll;
|
||||
if (broll > halfpi)
|
||||
broll = pi - broll;
|
||||
else if (broll < -halfpi)
|
||||
broll = -pi - broll;
|
||||
*/
|
||||
broll *= m_bankingEfficiency;
|
||||
if (m_bankingMix != 0)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
/// <summary>
|
||||
/// Scene that created this object.
|
||||
/// </summary>
|
||||
private ODEScene m_scene;
|
||||
private readonly ODEScene m_scene;
|
||||
|
||||
IntPtr ray; // the ray. we only need one for our lifetime
|
||||
IntPtr Sphere;
|
||||
@@ -65,9 +65,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
/// <summary>
|
||||
/// ODE near callback delegate
|
||||
/// </summary>
|
||||
private SafeNativeMethods.NearCallback nearCallback;
|
||||
private readonly SafeNativeMethods.NearCallback nearCallback;
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private List<ContactResult> m_contactResults = new List<ContactResult>();
|
||||
private readonly List<ContactResult> m_contactResults = new List<ContactResult>();
|
||||
private RayFilterFlags CurrentRayFilter;
|
||||
private int CurrentMaxCount;
|
||||
|
||||
@@ -127,9 +127,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
if (m_scene.haveActor(req.actor))
|
||||
{
|
||||
if (req.actor is OdePrim)
|
||||
geom = ((OdePrim)req.actor).prim_geom;
|
||||
geom = ((OdePrim)req.actor).m_prim_geom;
|
||||
else if (req.actor is OdeCharacter)
|
||||
geom = ((OdePrim)req.actor).prim_geom;
|
||||
geom = ((OdePrim)req.actor).m_prim_geom;
|
||||
}
|
||||
if (geom == IntPtr.Zero)
|
||||
{
|
||||
@@ -649,7 +649,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
/// </summary>
|
||||
internal void Dispose()
|
||||
{
|
||||
m_scene = null;
|
||||
if (ray != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.GeomDestroy(ray);
|
||||
|
||||
@@ -227,21 +227,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
|
||||
private SafeNativeMethods.NearCallback nearCallback;
|
||||
|
||||
private Dictionary<uint,OdePrim> _prims = new Dictionary<uint,OdePrim>();
|
||||
private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
|
||||
private HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
|
||||
private HashSet<OdePrim> _activegroups = new HashSet<OdePrim>();
|
||||
private readonly Dictionary<uint,OdePrim> _prims = new Dictionary<uint,OdePrim>();
|
||||
private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
|
||||
private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
|
||||
private readonly HashSet<OdePrim> _activegroups = new HashSet<OdePrim>();
|
||||
|
||||
public ConcurrentQueue<ODEchangeitem> ChangesQueue = new ConcurrentQueue<ODEchangeitem>();
|
||||
public readonly ConcurrentQueue<ODEchangeitem> ChangesQueue = new ConcurrentQueue<ODEchangeitem>();
|
||||
|
||||
/// <summary>
|
||||
/// A list of actors that should receive collision events.
|
||||
/// </summary>
|
||||
private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
|
||||
private List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
|
||||
private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
|
||||
private readonly List<PhysicsActor> _collisionEventPrimRemove = new List<PhysicsActor>();
|
||||
|
||||
private HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
|
||||
public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
|
||||
private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
|
||||
public readonly Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
|
||||
|
||||
private float contactsurfacelayer = 0.002f;
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
|
||||
private IntPtr contactgroup;
|
||||
|
||||
public ContactData[] m_materialContactsData = new ContactData[8];
|
||||
public readonly ContactData[] m_materialContactsData = new ContactData[8];
|
||||
|
||||
private IntPtr m_terrainGeom;
|
||||
private float[] m_terrainHeights;
|
||||
@@ -283,8 +283,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
public IntPtr StaticSpace; // space for the static things around
|
||||
public IntPtr GroundSpace; // space for ground
|
||||
|
||||
public object OdeLock = new object();
|
||||
public static object SimulationLock = new object();
|
||||
public readonly object OdeLock = new object();
|
||||
public static readonly object SimulationLock = new object();
|
||||
|
||||
public IMesher mesher;
|
||||
|
||||
@@ -1054,10 +1054,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
foreach (OdePrim aprim in _activegroups)
|
||||
{
|
||||
if(!aprim.m_outbounds && SafeNativeMethods.BodyIsEnabled(aprim.Body) &&
|
||||
aprim.collide_geom != IntPtr.Zero)
|
||||
aprim.m_collide_geom != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
|
||||
SafeNativeMethods.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
|
||||
SafeNativeMethods.SpaceCollide2(StaticSpace, aprim.m_collide_geom, IntPtr.Zero, nearCallback);
|
||||
SafeNativeMethods.SpaceCollide2(GroundSpace, aprim.m_collide_geom, IntPtr.Zero, nearCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2289,9 +2289,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
|
||||
IntPtr geom;
|
||||
if (actor is OdePrim)
|
||||
geom = ((OdePrim)actor).prim_geom;
|
||||
geom = ((OdePrim)actor).m_prim_geom;
|
||||
else if (actor is OdeCharacter)
|
||||
geom = ((OdePrim)actor).prim_geom;
|
||||
geom = ((OdePrim)actor).m_prim_geom;
|
||||
else
|
||||
return new List<ContactResult>();
|
||||
|
||||
@@ -2405,9 +2405,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
if (actor != null)
|
||||
{
|
||||
if (actor is OdePrim)
|
||||
geom = ((OdePrim)actor).prim_geom;
|
||||
geom = ((OdePrim)actor).m_prim_geom;
|
||||
else if (actor is OdeCharacter)
|
||||
geom = ((OdePrim)actor).prim_geom;
|
||||
geom = ((OdePrim)actor).m_prim_geom;
|
||||
}
|
||||
|
||||
List<ContactResult> ourResults = null;
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
/// </summary>
|
||||
public class ODESitAvatar
|
||||
{
|
||||
private ODEScene m_scene;
|
||||
private ODERayCastRequestManager m_raymanager;
|
||||
private readonly ODEScene m_scene;
|
||||
private readonly ODERayCastRequestManager m_raymanager;
|
||||
|
||||
public ODESitAvatar(ODEScene pScene, ODERayCastRequestManager raymanager)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
m_raymanager = raymanager;
|
||||
}
|
||||
|
||||
private static Vector3 SitAjust = new Vector3(0, 0, 0.4f);
|
||||
private static readonly Vector3 SitAjust = new Vector3(0, 0, 0.4f);
|
||||
private const RayFilterFlags RaySitFlags = RayFilterFlags.AllPrims | RayFilterFlags.ClosestHit;
|
||||
|
||||
private void RotAroundZ(float x, float y, ref Quaternion ori)
|
||||
@@ -64,22 +64,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
|
||||
public void Sit(PhysicsActor actor, Vector3 avPos, Vector3 avCameraPosition, Vector3 offset, Vector3 avOffset, SitAvatarCallback PhysicsSitResponse)
|
||||
{
|
||||
if (!m_scene.haveActor(actor) || !(actor is OdePrim) || ((OdePrim)actor).prim_geom == IntPtr.Zero)
|
||||
if (!m_scene.haveActor(actor) || !(actor is OdePrim) || ((OdePrim)actor).m_prim_geom == IntPtr.Zero)
|
||||
{
|
||||
PhysicsSitResponse(-1, actor.LocalID, offset, Quaternion.Identity);
|
||||
return;
|
||||
}
|
||||
|
||||
IntPtr geom = ((OdePrim)actor).prim_geom;
|
||||
IntPtr geom = ((OdePrim)actor).m_prim_geom;
|
||||
|
||||
Vector3 geopos = SafeNativeMethods.GeomGetPositionOMV(geom);
|
||||
Quaternion geomOri = SafeNativeMethods.GeomGetQuaternionOMV(geom);
|
||||
|
||||
// Vector3 geopos = actor.Position;
|
||||
// Quaternion geomOri = actor.Orientation;
|
||||
//Vector3 geopos = actor.Position;
|
||||
//Quaternion geomOri = actor.Orientation;
|
||||
|
||||
Quaternion geomInvOri = Quaternion.Conjugate(geomOri);
|
||||
|
||||
Quaternion ori = Quaternion.Identity;
|
||||
|
||||
Vector3 rayDir = geopos + offset - avCameraPosition;
|
||||
@@ -90,25 +89,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
PhysicsSitResponse(-1, actor.LocalID, offset, Quaternion.Identity);
|
||||
return;
|
||||
}
|
||||
|
||||
float t = 1 / raylen;
|
||||
rayDir.X *= t;
|
||||
rayDir.Y *= t;
|
||||
rayDir.Z *= t;
|
||||
|
||||
raylen += 30f; // focal point may be far
|
||||
List<ContactResult> rayResults;
|
||||
|
||||
rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir, raylen, 1, RaySitFlags);
|
||||
List<ContactResult> rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir, raylen, 1, RaySitFlags);
|
||||
if (rayResults.Count == 0)
|
||||
{
|
||||
/* if this fundamental ray failed, then just fail so user can try another spot and not be sitted far on a big prim
|
||||
/* if this fundamental ray failed, then just fail so user can try another spot and not be sitted far on a big prim
|
||||
d.AABB aabb;
|
||||
d.GeomGetAABB(geom, out aabb);
|
||||
offset = new Vector3(avOffset.X, 0, aabb.MaxZ + avOffset.Z - geopos.Z);
|
||||
ori = geomInvOri;
|
||||
offset *= geomInvOri;
|
||||
PhysicsSitResponse(1, actor.LocalID, offset, ori);
|
||||
*/
|
||||
*/
|
||||
PhysicsSitResponse(0, actor.LocalID, offset, ori);
|
||||
return;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user