Modifications for prim movement. For now only in Mod. BulletX, but i think it can be easy to add to ODE. Enjoy kick the prims and be careful with the falling ones ;D

This commit is contained in:
darok
2007-11-03 19:33:00 +00:00
parent dabbdec2cd
commit fbf3c6a768
3 changed files with 114 additions and 56 deletions

View File

@@ -55,6 +55,9 @@ namespace OpenSim.Region.Environment.Scenes
public bool HasChanged = false;
private LLVector3 lastPhysGroupPos;
private LLQuaternion lastPhysGroupRot;
#region Properties
/// <summary>
@@ -490,6 +493,25 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public override void Update()
{
if (lastPhysGroupPos.GetDistanceTo(AbsolutePosition) > 0.02)
{
foreach (SceneObjectPart part in m_parts.Values)
{
if (part.UpdateFlag == 0) part.UpdateFlag = 1;
}
lastPhysGroupPos = AbsolutePosition;
}
if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
{
foreach (SceneObjectPart part in m_parts.Values)
{
if (part.UpdateFlag == 0) part.UpdateFlag = 1;
}
lastPhysGroupRot = GroupRotation;
}
foreach (SceneObjectPart part in m_parts.Values)
{
part.SendScheduledUpdates();

View File

@@ -148,8 +148,34 @@ namespace OpenSim.Region.Environment.Scenes
public LLVector3 GroupPosition
{
get { return m_groupPosition; }
set { m_groupPosition = value; }
get
{
if (PhysActor != null)
{
m_groupPosition.X = PhysActor.Position.X;
m_groupPosition.Y = PhysActor.Position.Y;
m_groupPosition.Z = PhysActor.Position.Z;
}
return m_groupPosition;
}
set
{
if (PhysActor != null)
{
try
{
//lock (m_scene.SyncRoot)
//{
PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
//}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
m_groupPosition = value;
}
}
protected LLVector3 m_offsetPosition;
@@ -169,8 +195,35 @@ namespace OpenSim.Region.Environment.Scenes
public LLQuaternion RotationOffset
{
get { return m_rotationOffset; }
set { m_rotationOffset = value; }
get
{
if (PhysActor != null)
{
m_rotationOffset.X = PhysActor.Orientation.x;
m_rotationOffset.Y = PhysActor.Orientation.y;
m_rotationOffset.Z = PhysActor.Orientation.z;
m_rotationOffset.W = PhysActor.Orientation.w;
}
return m_rotationOffset;
}
set
{
if (PhysActor != null)
{
try
{
//lock (m_scene.SyncRoot)
//{
PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z);
//}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
m_rotationOffset = value;
}
}
protected LLVector3 m_velocity;
@@ -260,7 +313,12 @@ namespace OpenSim.Region.Environment.Scenes
public SceneObjectGroup ParentGroup
{
get { return m_parentGroup; }
}
public byte UpdateFlag
{
get { return m_updateFlag; }
set { m_updateFlag = value; }
}
#region Constructors
@@ -502,6 +560,7 @@ namespace OpenSim.Region.Environment.Scenes
{
AddTerseUpdateToAllAvatars();
ClearUpdateSchedule();
ScheduleTerseUpdate();
}
else
{
@@ -706,6 +765,10 @@ namespace OpenSim.Region.Environment.Scenes
new Quaternion(RotationOffset.W, RotationOffset.X,
RotationOffset.Y, RotationOffset.Z), UsePhysics);
}
else
{
PhysActor.IsPhysical = UsePhysics;
}
}
if (IsTemporary)