Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
commit
ebfa614bf9
|
@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
qtmp.Y = req.orientation.Y;
|
qtmp.Y = req.orientation.Y;
|
||||||
qtmp.Z = req.orientation.Z;
|
qtmp.Z = req.orientation.Z;
|
||||||
qtmp.W = req.orientation.W;
|
qtmp.W = req.orientation.W;
|
||||||
d.GeomSetOffsetWorldQuaternion(Box, ref qtmp);
|
d.GeomSetQuaternion(Box, ref qtmp);
|
||||||
}
|
}
|
||||||
else if (req.callbackMethod is ProbeSphereCallback)
|
else if (req.callbackMethod is ProbeSphereCallback)
|
||||||
{
|
{
|
||||||
|
@ -480,12 +480,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return;
|
return;
|
||||||
|
/*
|
||||||
uint cat1 = d.GeomGetCategoryBits(g1);
|
uint cat1 = d.GeomGetCategoryBits(g1);
|
||||||
uint cat2 = d.GeomGetCategoryBits(g2);
|
uint cat2 = d.GeomGetCategoryBits(g2);
|
||||||
uint col1 = d.GeomGetCollideBits(g1);
|
uint col1 = d.GeomGetCollideBits(g1);
|
||||||
uint col2 = d.GeomGetCollideBits(g2);
|
uint col2 = d.GeomGetCollideBits(g2);
|
||||||
|
*/
|
||||||
|
|
||||||
uint ID = 0;
|
uint ID = 0;
|
||||||
PhysicsActor p2 = null;
|
PhysicsActor p2 = null;
|
||||||
|
|
|
@ -78,36 +78,20 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
IntPtr geom = ((OdePrim)actor).prim_geom;
|
IntPtr geom = ((OdePrim)actor).prim_geom;
|
||||||
|
|
||||||
d.Vector3 dtmp = d.GeomGetPosition(geom);
|
Vector3 geopos = d.GeomGetPositionOMV(geom);
|
||||||
Vector3 geopos;
|
Quaternion geomOri = d.GeomGetQuaternionOMV(geom);
|
||||||
geopos.X = dtmp.X;
|
Quaternion geomInvOri = Quaternion.Conjugate(geomOri);
|
||||||
geopos.Y = dtmp.Y;
|
|
||||||
geopos.Z = dtmp.Z;
|
|
||||||
|
|
||||||
|
|
||||||
d.AABB aabb;
|
|
||||||
Quaternion ori = Quaternion.Identity;
|
Quaternion ori = Quaternion.Identity;
|
||||||
d.Quaternion qtmp;
|
|
||||||
d.GeomCopyQuaternion(geom, out qtmp);
|
|
||||||
Quaternion geomOri;
|
|
||||||
geomOri.X = qtmp.X;
|
|
||||||
geomOri.Y = qtmp.Y;
|
|
||||||
geomOri.Z = qtmp.Z;
|
|
||||||
geomOri.W = qtmp.W;
|
|
||||||
Quaternion geomInvOri;
|
|
||||||
geomInvOri.X = -qtmp.X;
|
|
||||||
geomInvOri.Y = -qtmp.Y;
|
|
||||||
geomInvOri.Z = -qtmp.Z;
|
|
||||||
geomInvOri.W = qtmp.W;
|
|
||||||
|
|
||||||
Vector3 rayDir = geopos + offset - avCameraPosition;
|
Vector3 rayDir = geopos + offset - avCameraPosition;
|
||||||
|
|
||||||
float raylen = rayDir.Length();
|
float raylen = rayDir.Length();
|
||||||
if (raylen < 0.001f)
|
if (raylen < 0.001f)
|
||||||
{
|
{
|
||||||
PhysicsSitResponse(-1, actor.LocalID, offset, Quaternion.Identity);
|
PhysicsSitResponse(-1, actor.LocalID, offset, Quaternion.Identity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float t = 1 / raylen;
|
float t = 1 / raylen;
|
||||||
rayDir.X *= t;
|
rayDir.X *= t;
|
||||||
rayDir.Y *= t;
|
rayDir.Y *= t;
|
||||||
|
@ -119,22 +103,25 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir, raylen, 1, RaySitFlags);
|
rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir, raylen, 1, RaySitFlags);
|
||||||
if (rayResults.Count == 0)
|
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
|
||||||
|
d.AABB aabb;
|
||||||
d.GeomGetAABB(geom, out aabb);
|
d.GeomGetAABB(geom, out aabb);
|
||||||
offset = new Vector3(avOffset.X, 0, aabb.MaxZ + avOffset.Z - geopos.Z);
|
offset = new Vector3(avOffset.X, 0, aabb.MaxZ + avOffset.Z - geopos.Z);
|
||||||
ori = geomInvOri;
|
ori = geomInvOri;
|
||||||
offset *= geomInvOri;
|
offset *= geomInvOri;
|
||||||
|
|
||||||
PhysicsSitResponse(1, actor.LocalID, offset, ori);
|
PhysicsSitResponse(1, actor.LocalID, offset, ori);
|
||||||
|
*/
|
||||||
|
PhysicsSitResponse(0, actor.LocalID, offset, ori);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int status = 1;
|
||||||
offset = rayResults[0].Pos - geopos;
|
offset = rayResults[0].Pos - geopos;
|
||||||
|
|
||||||
d.GeomClassID geoclass = d.GeomGetClass(geom);
|
d.GeomClassID geoclass = d.GeomGetClass(geom);
|
||||||
|
|
||||||
if (geoclass == d.GeomClassID.SphereClass)
|
if (geoclass == d.GeomClassID.SphereClass)
|
||||||
{
|
{
|
||||||
int status = 1;
|
|
||||||
float r = d.GeomSphereGetRadius(geom);
|
float r = d.GeomSphereGetRadius(geom);
|
||||||
|
|
||||||
offset.Normalize();
|
offset.Normalize();
|
||||||
|
@ -165,7 +152,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
status = 3;
|
status = 3;
|
||||||
avOffset.X = -avOffset.X;
|
avOffset.X = -avOffset.X;
|
||||||
avOffset.Z += 0.4f;
|
avOffset.Z *= 1.6f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,6 +173,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float SitNormX = -rayDir.X;
|
float SitNormX = -rayDir.X;
|
||||||
float SitNormY = -rayDir.Y;
|
float SitNormY = -rayDir.Y;
|
||||||
|
|
||||||
|
@ -204,7 +192,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
float rayDist = 4.0f;
|
float rayDist = 4.0f;
|
||||||
float curEdgeDist = 0.0f;
|
float curEdgeDist = 0.0f;
|
||||||
pivot = geopos + offset;
|
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
|
@ -239,11 +226,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foundEdge = true;
|
foundEdge = true;
|
||||||
if (curEdgeDist < edgeDist)
|
|
||||||
{
|
|
||||||
edgeDist = curEdgeDist;
|
edgeDist = curEdgeDist;
|
||||||
edgePos = rayResults[0].Pos;
|
edgePos = rayResults[0].Pos;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +251,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
float rayDist = 1.0f;
|
float rayDist = 1.0f;
|
||||||
float curEdgeDist = 0.0f;
|
float curEdgeDist = 0.0f;
|
||||||
pivot = geopos + offset;
|
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
|
@ -310,6 +293,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (foundEdge && edgeDist < 0.2f)
|
if (foundEdge && edgeDist < 0.2f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
pivot = geopos + offset;
|
||||||
|
|
||||||
switch (j)
|
switch (j)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -332,7 +317,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (!foundEdge)
|
if (!foundEdge)
|
||||||
{
|
{
|
||||||
avOffset.X = -avOffset.X;
|
avOffset.X = -avOffset.X;
|
||||||
avOffset.Z += 0.4f;
|
avOffset.Z *= 1.6f;
|
||||||
|
|
||||||
RotAroundZ(SitNormX, SitNormY, ref ori);
|
RotAroundZ(SitNormX, SitNormY, ref ori);
|
||||||
|
|
||||||
|
@ -349,7 +334,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
SitNormX = edgeNormalX;
|
SitNormX = edgeNormalX;
|
||||||
SitNormY = edgeNormalY;
|
SitNormY = edgeNormalY;
|
||||||
offset = edgePos - geopos;
|
|
||||||
if (edgeDirX * SitNormX + edgeDirY * SitNormY < 0)
|
if (edgeDirX * SitNormX + edgeDirY * SitNormY < 0)
|
||||||
{
|
{
|
||||||
SitNormX = -SitNormX;
|
SitNormX = -SitNormX;
|
||||||
|
@ -358,7 +342,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
RotAroundZ(SitNormX, SitNormY, ref ori);
|
RotAroundZ(SitNormX, SitNormY, ref ori);
|
||||||
|
|
||||||
offset += avOffset * ori;
|
offset = edgePos + avOffset * ori;
|
||||||
|
offset -= geopos;
|
||||||
|
|
||||||
ori = geomInvOri * ori;
|
ori = geomInvOri * ori;
|
||||||
offset *= geomInvOri;
|
offset *= geomInvOri;
|
||||||
|
|
|
@ -44,7 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
|
using OMV = OpenMetaverse;
|
||||||
namespace OdeAPI
|
namespace OdeAPI
|
||||||
{
|
{
|
||||||
//#if dDOUBLE
|
//#if dDOUBLE
|
||||||
|
@ -925,9 +925,20 @@ namespace OdeAPI
|
||||||
{
|
{
|
||||||
unsafe { return *(GeomGetPositionUnsafe(geom)); }
|
unsafe { return *(GeomGetPositionUnsafe(geom)); }
|
||||||
}
|
}
|
||||||
|
public static OMV.Vector3 GeomGetPositionOMV(IntPtr geom)
|
||||||
|
{
|
||||||
|
Vector3 vtmp = GeomGetPosition(geom);
|
||||||
|
return new OMV.Vector3(vtmp.X, vtmp.Y, vtmp.Z);
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity]
|
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity]
|
||||||
public static extern void GeomCopyQuaternion(IntPtr geom, out Quaternion q);
|
public static extern void GeomCopyQuaternion(IntPtr geom, out Quaternion q);
|
||||||
|
public static OMV.Quaternion GeomGetQuaternionOMV(IntPtr geom)
|
||||||
|
{
|
||||||
|
Quaternion qtmp;
|
||||||
|
GeomCopyQuaternion(geom, out qtmp);
|
||||||
|
return new OMV.Quaternion(qtmp.X, qtmp.Y, qtmp.Z, qtmp.W);
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity]
|
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity]
|
||||||
public static extern void GeomCopyQuaternion(IntPtr geom, out dReal X);
|
public static extern void GeomCopyQuaternion(IntPtr geom, out dReal X);
|
||||||
|
|
Loading…
Reference in New Issue