Changes of PrimShapeType should now work with UbitOde ( almost untested )

avinationmerge
UbitUmarov 2012-03-21 02:39:16 +00:00
parent 11ed932263
commit f6cbafcaf0
2 changed files with 3750 additions and 3727 deletions

View File

@ -1497,6 +1497,7 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_physicsShapeType; }
set
{
byte oldv = m_physicsShapeType;
if (value >= 0 && value <= (byte)PhysShapeType.convex)
{
if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this)
@ -1507,13 +1508,35 @@ namespace OpenSim.Region.Framework.Scenes
else
m_physicsShapeType = DefaultPhysicsShapeType();
if (m_physicsShapeType != oldv && ParentGroup != null)
{
if (m_physicsShapeType == (byte)PhysShapeType.none)
{
if (PhysActor != null)
{
Velocity = new Vector3(0, 0, 0);
Acceleration = new Vector3(0, 0, 0);
if (ParentGroup.RootPart == this)
AngularVelocity = new Vector3(0, 0, 0);
ParentGroup.Scene.RemovePhysicalPrim(1);
RemoveFromPhysics();
}
}
else if (PhysActor == null)
ApplyPhysics((uint)Flags, VolumeDetectActive, false);
else
PhysActor.PhysicsShapeType = m_physicsShapeType;
}
if (m_physicsShapeType != value)
{
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
if(m_physicsShapeType != value)
UpdatePhysRequired = true;
}
}
}
public float Density // in kg/m^3
{
@ -4575,20 +4598,6 @@ namespace OpenSim.Region.Framework.Scenes
{
PhysicsShapeType = (byte)physdata.PhysShapeType;
if (PhysicsShapeType == (byte)PhysShapeType.none)
{
if (PhysActor != null)
{
Velocity = new Vector3(0, 0, 0);
Acceleration = new Vector3(0, 0, 0);
if (ParentGroup.RootPart == this)
AngularVelocity = new Vector3(0, 0, 0);
ParentGroup.Scene.RemovePhysicalPrim(1);
RemoveFromPhysics();
}
}
else if (PhysActor == null)
ApplyPhysics((uint)Flags, VolumeDetectActive, false);
}
if(Density != physdata.Density)

View File

@ -486,6 +486,19 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
public override byte PhysicsShapeType
{
get
{
return m_shapetype;
}
set
{
m_shapetype = value;
AddChange(changes.Shape, null);
}
}
public override Vector3 Velocity
{
get
@ -2844,6 +2857,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private void changeShape(PrimitiveBaseShape newShape)
{
if(newShape != null)
_pbs = newShape;
changeprimsizeshape();
}