mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
Merge branch 'master' into careminster
This commit is contained in:
@@ -44,8 +44,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||
private bool flying;
|
||||
private bool iscolliding;
|
||||
|
||||
public BasicActor()
|
||||
public BasicActor(Vector3 size)
|
||||
{
|
||||
Size = size;
|
||||
}
|
||||
|
||||
public override int PhysicsActorType
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||
}
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
{
|
||||
BasicActor act = new BasicActor();
|
||||
BasicActor act = new BasicActor(size);
|
||||
act.Position = position;
|
||||
act.Flying = isFlying;
|
||||
_actors.Add(act);
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
internal IntPtr Body = IntPtr.Zero;
|
||||
private OdeScene _parent_scene;
|
||||
internal IntPtr Shell = IntPtr.Zero;
|
||||
internal IntPtr Amotor = IntPtr.Zero;
|
||||
private IntPtr Amotor = IntPtr.Zero;
|
||||
private d.Mass ShellMass;
|
||||
|
||||
private int m_eventsubscription = 0;
|
||||
@@ -195,13 +195,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
// new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
|
||||
// 0.5f);
|
||||
|
||||
for (int i = 0; i < 11; i++)
|
||||
{
|
||||
m_colliderarr[i] = false;
|
||||
}
|
||||
CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
||||
//m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH.ToString());
|
||||
m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH;
|
||||
// We can set taint and actual to be the same here, since the entire character will be set up when the
|
||||
// m_tainted_isPhysical is processed.
|
||||
SetTaintedCapsuleLength(size);
|
||||
CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH;
|
||||
|
||||
m_isPhysical = false; // current status: no ODE information exists
|
||||
m_tainted_isPhysical = true; // new tainted status: need to create ODE information
|
||||
@@ -457,24 +454,28 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
||||
set
|
||||
{
|
||||
if (value.IsFinite())
|
||||
{
|
||||
m_pidControllerActive = true;
|
||||
|
||||
Vector3 SetSize = value;
|
||||
m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
||||
// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
|
||||
SetTaintedCapsuleLength(value);
|
||||
|
||||
// If we reset velocity here, then an avatar stalls when it crosses a border for the first time
|
||||
// (as the height of the new root agent is set).
|
||||
// Velocity = Vector3.Zero;
|
||||
|
||||
_parent_scene.AddPhysicsActorTaint(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size from Scene on {0}", Name);
|
||||
}
|
||||
_parent_scene.AddPhysicsActorTaint(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTaintedCapsuleLength(Vector3 size)
|
||||
{
|
||||
if (size.IsFinite())
|
||||
{
|
||||
m_pidControllerActive = true;
|
||||
|
||||
m_tainted_CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
||||
// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,8 +550,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
{
|
||||
get
|
||||
{
|
||||
float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH);
|
||||
return m_density*AVvolume;
|
||||
float AVvolume = (float)(Math.PI * Math.Pow(CAPSULE_RADIUS, 2) * CAPSULE_LENGTH);
|
||||
return m_density * AVvolume;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1699,7 +1699,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
|
||||
public override void RemoveAvatar(PhysicsActor actor)
|
||||
{
|
||||
//m_log.Debug("[PHYSICS]:ODELOCK");
|
||||
// m_log.DebugFormat(
|
||||
// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}",
|
||||
// actor.Name, actor.LocalID, Name);
|
||||
|
||||
((OdeCharacter) actor).Destroy();
|
||||
}
|
||||
|
||||
@@ -1709,6 +1712,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
{
|
||||
_characters.Add(chr);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ODE SCENE]: Adding physics character {0} {1} to physics scene {2}. Count now {3}",
|
||||
// chr.Name, chr.LocalID, Name, _characters.Count);
|
||||
|
||||
if (chr.bad)
|
||||
m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid);
|
||||
}
|
||||
@@ -1723,11 +1730,19 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
internal void RemoveCharacter(OdeCharacter chr)
|
||||
{
|
||||
if (_characters.Contains(chr))
|
||||
{
|
||||
_characters.Remove(chr);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}. Count now {3}",
|
||||
// chr.Name, chr.LocalID, Name, _characters.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!",
|
||||
chr.Name, chr.LocalID);
|
||||
}
|
||||
}
|
||||
|
||||
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
|
||||
@@ -1765,7 +1780,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
|
||||
{
|
||||
// m_log.DebugFormat("[ODE SCENE]: Adding physics actor to {0} {1}", primName, localid);
|
||||
// m_log.DebugFormat("[ODE SCENE]: Adding physics prim {0} {1} to physics scene {2}", primName, localid, Name);
|
||||
|
||||
return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid);
|
||||
}
|
||||
@@ -2755,6 +2770,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
{
|
||||
foreach (OdeCharacter actor in defects)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving",
|
||||
actor.Name, actor.LocalID, Name);
|
||||
|
||||
RemoveCharacter(actor);
|
||||
actor.DestroyOdeStructures();
|
||||
}
|
||||
@@ -2825,6 +2844,10 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
{
|
||||
foreach (OdeCharacter actor in defects)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity",
|
||||
actor.Name, actor.LocalID, Name);
|
||||
|
||||
RemoveCharacter(actor);
|
||||
actor.DestroyOdeStructures();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user