a few changes to ubode; update unmanaged for windows and linuxx86-64. Mac and other os need some nice people contribution. As usualy this can be very bad (BSOD even)

This commit is contained in:
UbitUmarov
2022-08-07 18:20:38 +01:00
parent 7a710f09c0
commit 1b928c9fbd
6 changed files with 48 additions and 31 deletions

View File

@@ -140,7 +140,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
);
// we do land collisions not ode | CollisionCategories.Land);
public IntPtr Body = IntPtr.Zero;
private IntPtr capsule = IntPtr.Zero;
//private IntPtr capsule = IntPtr.Zero;
public IntPtr collider = IntPtr.Zero;
public IntPtr Amotor = IntPtr.Zero;
@@ -852,11 +852,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace);
collider = SafeNativeMethods.SimpleSpaceCreate(m_parent_scene.CharsSpace);
SafeNativeMethods.SpaceSetSublevel(collider, 3);
SafeNativeMethods.SpaceSetCleanup(collider, false);
SafeNativeMethods.GeomSetCategoryBits(collider, (uint)m_collisionCategories);
SafeNativeMethods.GeomSetCollideBits(collider, (uint)m_collisionFlags);
//collider = SafeNativeMethods.SimpleSpaceCreate(m_parent_scene.CharsSpace);
//SafeNativeMethods.SpaceSetSublevel(collider, 0);
//SafeNativeMethods.SpaceSetCleanup(collider, false);
//SafeNativeMethods.GeomSetCategoryBits(collider, (uint)m_collisionCategories);
//SafeNativeMethods.GeomSetCollideBits(collider, (uint)m_collisionFlags);
float r = sx;
if (sy > r)
@@ -864,7 +864,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
float l = sz - r;
r *= 0.5f;
capsule = SafeNativeMethods.CreateCapsule(collider, r, l);
//capsule = SafeNativeMethods.CreateCapsule(collider, r, l);
collider = SafeNativeMethods.CreateCapsule(m_parent_scene.CharsSpace, r, l);
SafeNativeMethods.GeomSetCategoryBits(collider, (uint)m_collisionCategories);
SafeNativeMethods.GeomSetCollideBits(collider, (uint)m_collisionFlags);
// update mass
m_mass = m_density * sx * sy * sz;
@@ -893,7 +896,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
_position.Z = npositionZ;
SafeNativeMethods.BodySetMass(Body, ref ShellMass);
SafeNativeMethods.GeomSetBody(capsule, Body);
//SafeNativeMethods.GeomSetBody(capsule, Body);
SafeNativeMethods.GeomSetBody(collider, Body);
// The purpose of the AMotor here is to keep the avatar's physical
// surrogate from rotating while moving
@@ -954,6 +958,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
//kill the Geoms
/*
if (capsule != IntPtr.Zero)
{
m_parent_scene.actor_name_map.Remove(capsule);
@@ -967,6 +972,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
SafeNativeMethods.SpaceDestroy(collider);
collider = IntPtr.Zero;
}
*/
if (collider != IntPtr.Zero)
{
m_parent_scene.actor_name_map.Remove(collider);
SafeNativeMethods.GeomDestroy(collider);
collider = IntPtr.Zero;
}
}
//in place 2D rotation around Z assuming rot is normalised and is a rotation around Z
@@ -1008,7 +1020,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
feetcollision = false;
useAltcontact = false;
if (me == capsule)
//if (me == capsule)
if (me == collider)
{
Vector3 offset;
@@ -1228,7 +1241,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
//******************************************
// colide with land
SafeNativeMethods.GeomGetAABB(capsule, out SafeNativeMethods.AABB aabb);
//SafeNativeMethods.GeomGetAABB(capsule, out SafeNativeMethods.AABB aabb);
SafeNativeMethods.GeomGetAABB(collider, out SafeNativeMethods.AABB aabb);
float chrminZ = aabb.MinZ; // move up a bit
Vector3 posch = localpos;
@@ -1809,7 +1823,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z);
m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this;
//m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this;
m_parent_scene.actor_name_map[collider] = (PhysicsActor)this;
m_parent_scene.AddCharacter(this);
}
else
@@ -1878,7 +1893,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
float l = sz - r;
r *= 0.5f;
SafeNativeMethods.GeomCapsuleSetParams(capsule, r, l);
//SafeNativeMethods.GeomCapsuleSetParams(capsule, r, l);
SafeNativeMethods.GeomCapsuleSetParams(collider, r, l);
m_mass = m_density * sx * sy * sz; // update mass
m_massInvTimeScaled = m_mass * m_sceneInverseTimeStep;

View File

@@ -2021,7 +2021,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
else
{
m_targetSpace = SafeNativeMethods.SimpleSpaceCreate(m_parentScene.ActiveSpace);
SafeNativeMethods.SpaceSetSublevel(m_targetSpace, 3);
SafeNativeMethods.SpaceSetSublevel(m_targetSpace, 0);
SafeNativeMethods.SpaceSetCleanup(m_targetSpace, false);
SafeNativeMethods.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space |

View File

@@ -359,19 +359,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
ActiveSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace);
CharsSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace);
GroundSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace);
float sx = WorldExtents.X + 16;
float sy = WorldExtents.Y + 16;
SafeNativeMethods.Vector3 ex =new SafeNativeMethods.Vector3(sx, sy, 0);
SafeNativeMethods.Vector3 px =new SafeNativeMethods.Vector3(sx * 0.5f, sx * 0.5f, 0);
if(sx < sy)
float sx = m_regionWidth + 16;
float sy = m_regionHeight + 16;
SafeNativeMethods.Vector3 px = new SafeNativeMethods.Vector3(sx * 0.5f, sy * 0.5f, 0);
if (sx < sy)
sx = sy;
sx = (float)Math.Log(sx) * 1.442695f + 0.5f;
int dp = (int)sx - 2;
int dp = (int)sx - 1;
if(dp > 8)
dp = 8;
else if(dp < 4)
dp = 4;
StaticSpace = SafeNativeMethods.QuadTreeSpaceCreate(TopSpace, ref px, ref ex, dp);
//StaticSpace = SafeNativeMethods.QuadTreeSpaceCreate(TopSpace, ref px, ref ex, dp);
StaticSpace = SafeNativeMethods.QuadTreeSpaceCreate(TopSpace, ref px, ref px, dp);
}
catch
{
@@ -379,7 +379,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// i did!
}
// demote to second level
// move to second level
SafeNativeMethods.SpaceSetSublevel(ActiveSpace, 1);
SafeNativeMethods.SpaceSetSublevel(CharsSpace, 1);
SafeNativeMethods.SpaceSetSublevel(StaticSpace, 1);
@@ -2158,15 +2158,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
if (retMethod != null)
{
ODERayRequest req = new ODERayRequest();
req.actor = null;
req.callbackMethod = retMethod;
req.length = length;
req.Normal = direction;
req.Origin = position;
req.Count = 0;
req.filter = RayFilterFlags.AllPrims;
ODERayRequest req = new ODERayRequest()
{
actor = null,
callbackMethod = retMethod,
length = length,
Normal = direction,
Origin = position,
Count = 0,
filter = RayFilterFlags.AllPrims
};
m_rayCastManager.QueueRequest(req);
}
}
@@ -2254,7 +2255,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
lock (SyncObject)
{
m_rayCastManager.QueueRequest(req);
if (!Monitor.Wait(SyncObject, 500))
if (!Monitor.Wait(SyncObject, 10000))
return null;
else
return ourresults;