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; } get { return m_physicsShapeType; }
set set
{ {
byte oldv = m_physicsShapeType;
if (value >= 0 && value <= (byte)PhysShapeType.convex) if (value >= 0 && value <= (byte)PhysShapeType.convex)
{ {
if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this) if (value == (byte)PhysShapeType.none && ParentGroup != null && ParentGroup.RootPart == this)
@ -1507,11 +1508,33 @@ namespace OpenSim.Region.Framework.Scenes
else else
m_physicsShapeType = DefaultPhysicsShapeType(); m_physicsShapeType = DefaultPhysicsShapeType();
if (ParentGroup != null)
ParentGroup.HasGroupChanged = true;
if(m_physicsShapeType != value) 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;
UpdatePhysRequired = true; UpdatePhysRequired = true;
}
} }
} }
@ -4575,20 +4598,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
PhysicsShapeType = (byte)physdata.PhysShapeType; 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) 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 public override Vector3 Velocity
{ {
get get
@ -2844,7 +2857,8 @@ namespace OpenSim.Region.Physics.OdePlugin
private void changeShape(PrimitiveBaseShape newShape) private void changeShape(PrimitiveBaseShape newShape)
{ {
_pbs = newShape; if(newShape != null)
_pbs = newShape;
changeprimsizeshape(); changeprimsizeshape();
} }