mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
Merge branch 'vehicles' into tests
Conflicts: OpenSim/Region/Physics/Manager/PhysicsActor.cs OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
This commit is contained in:
@@ -102,16 +102,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
#region Fields
|
||||
|
||||
public bool AllowedDrop = false;
|
||||
public bool AllowedDrop;
|
||||
|
||||
[XmlIgnore]
|
||||
public bool DIE_AT_EDGE = false;
|
||||
public bool DIE_AT_EDGE;
|
||||
|
||||
// TODO: This needs to be persisted in next XML version update!
|
||||
[XmlIgnore]
|
||||
public int[] PayPrice = {-2,-2,-2,-2,-2};
|
||||
public readonly int[] PayPrice = {-2,-2,-2,-2,-2};
|
||||
[XmlIgnore]
|
||||
public PhysicsActor PhysActor = null;
|
||||
public PhysicsActor PhysActor;
|
||||
|
||||
//Xantor 20080528 Sound stuff:
|
||||
// Note: This isn't persisted in the database right now, as the fields for that aren't just there yet.
|
||||
@@ -130,55 +130,56 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public double SoundRadius;
|
||||
|
||||
[XmlIgnore]
|
||||
public uint TimeStampFull = 0;
|
||||
public uint TimeStampFull;
|
||||
|
||||
[XmlIgnore]
|
||||
public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
|
||||
public uint TimeStampLastActivity; // Will be used for AutoReturn
|
||||
|
||||
[XmlIgnore]
|
||||
public uint TimeStampTerse = 0;
|
||||
|
||||
public uint TimeStampTerse;
|
||||
|
||||
[XmlIgnore]
|
||||
public UUID FromItemID = UUID.Zero;
|
||||
public UUID FromItemID;
|
||||
|
||||
/// <value>
|
||||
/// The UUID of the user inventory item from which this object was rezzed if this is a root part.
|
||||
/// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item.
|
||||
/// </value>
|
||||
private UUID m_fromUserInventoryItemID = UUID.Zero;
|
||||
private UUID m_fromUserInventoryItemID;
|
||||
|
||||
[XmlIgnore]
|
||||
public UUID FromUserInventoryItemID
|
||||
{
|
||||
get { return m_fromUserInventoryItemID; }
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public bool IsAttachment = false;
|
||||
|
||||
[XmlIgnore]
|
||||
public scriptEvents AggregateScriptEvents = 0;
|
||||
|
||||
[XmlIgnore]
|
||||
public UUID AttachedAvatar = UUID.Zero;
|
||||
|
||||
[XmlIgnore]
|
||||
public Vector3 AttachedPos = Vector3.Zero;
|
||||
|
||||
[XmlIgnore]
|
||||
public uint AttachmentPoint = (byte)0;
|
||||
|
||||
[XmlIgnore]
|
||||
public PhysicsVector RotationAxis = new PhysicsVector(1f,1f,1f);
|
||||
|
||||
[XmlIgnore]
|
||||
public bool VolumeDetectActive = false; // XmlIgnore set to avoid problems with persistance until I come to care for this
|
||||
// Certainly this must be a persistant setting finally
|
||||
public bool IsAttachment;
|
||||
|
||||
[XmlIgnore]
|
||||
public bool IsWaitingForFirstSpinUpdatePacket = false;
|
||||
public scriptEvents AggregateScriptEvents;
|
||||
|
||||
[XmlIgnore]
|
||||
public Quaternion SpinOldOrientation = new Quaternion();
|
||||
public UUID AttachedAvatar;
|
||||
|
||||
[XmlIgnore]
|
||||
public Vector3 AttachedPos;
|
||||
|
||||
[XmlIgnore]
|
||||
public uint AttachmentPoint;
|
||||
|
||||
[XmlIgnore]
|
||||
public Vector3 RotationAxis = Vector3.One;
|
||||
|
||||
[XmlIgnore]
|
||||
public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this
|
||||
// Certainly this must be a persistant setting finally
|
||||
|
||||
[XmlIgnore]
|
||||
public bool IsWaitingForFirstSpinUpdatePacket;
|
||||
|
||||
[XmlIgnore]
|
||||
public Quaternion SpinOldOrientation = Quaternion.Identity;
|
||||
|
||||
/// <summary>
|
||||
/// This part's inventory
|
||||
@@ -191,34 +192,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected SceneObjectPartInventory m_inventory;
|
||||
|
||||
[XmlIgnore]
|
||||
public bool Undoing = false;
|
||||
public bool Undoing;
|
||||
|
||||
[XmlIgnore]
|
||||
private PrimFlags LocalFlags = 0;
|
||||
private PrimFlags LocalFlags;
|
||||
[XmlIgnore]
|
||||
private float m_damage = -1.0f;
|
||||
private byte[] m_TextureAnimation;
|
||||
private byte m_clickAction = 0;
|
||||
private byte m_clickAction;
|
||||
private Color m_color = Color.Black;
|
||||
private string m_description = String.Empty;
|
||||
private readonly List<uint> m_lastColliders = new List<uint>();
|
||||
// private PhysicsVector m_lastRotationalVelocity = PhysicsVector.Zero;
|
||||
private int m_linkNum = 0;
|
||||
private int m_linkNum;
|
||||
[XmlIgnore]
|
||||
private int m_scriptAccessPin = 0;
|
||||
private int m_scriptAccessPin;
|
||||
[XmlIgnore]
|
||||
private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>();
|
||||
private string m_sitName = String.Empty;
|
||||
private Quaternion m_sitTargetOrientation = Quaternion.Identity;
|
||||
private Vector3 m_sitTargetPosition = Vector3.Zero;
|
||||
private Vector3 m_sitTargetPosition;
|
||||
private string m_sitAnimation = "SIT";
|
||||
private string m_text = String.Empty;
|
||||
private string m_touchName = String.Empty;
|
||||
private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
|
||||
private UUID _creatorID;
|
||||
|
||||
|
||||
private bool m_passTouches = false;
|
||||
private bool m_passTouches;
|
||||
|
||||
/// <summary>
|
||||
/// Only used internally to schedule client updates.
|
||||
@@ -236,28 +235,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//unkown if this will be kept, added as a way of removing the group position from the group class
|
||||
protected Vector3 m_groupPosition;
|
||||
protected uint m_localId;
|
||||
protected Material m_material = (Material)3; // Wood
|
||||
protected Material m_material = OpenMetaverse.Material.Wood;
|
||||
protected string m_name;
|
||||
protected Vector3 m_offsetPosition;
|
||||
|
||||
// FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
|
||||
protected SceneObjectGroup m_parentGroup;
|
||||
protected byte[] m_particleSystem = new byte[0];
|
||||
protected byte[] m_particleSystem = Utils.EmptyBytes;
|
||||
protected ulong m_regionHandle;
|
||||
protected Quaternion m_rotationOffset;
|
||||
protected PrimitiveBaseShape m_shape = null;
|
||||
protected PrimitiveBaseShape m_shape;
|
||||
protected UUID m_uuid;
|
||||
protected Vector3 m_velocity;
|
||||
|
||||
protected Vector3 m_lastPosition;
|
||||
protected Quaternion m_lastRotation;
|
||||
protected Vector3 m_lastVelocity;
|
||||
protected Vector3 m_lastAcceleration;
|
||||
protected Vector3 m_lastAngularVelocity;
|
||||
|
||||
// TODO: Those have to be changed into persistent properties at some later point,
|
||||
// or sit-camera on vehicles will break on sim-crossing.
|
||||
private Vector3 m_cameraEyeOffset = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
private bool m_forceMouselook = false;
|
||||
private Vector3 m_cameraEyeOffset;
|
||||
private Vector3 m_cameraAtOffset;
|
||||
private bool m_forceMouselook;
|
||||
|
||||
// TODO: Collision sound should have default.
|
||||
private UUID m_collisionSound = UUID.Zero;
|
||||
private float m_collisionSoundVolume = 0.0f;
|
||||
private UUID m_collisionSound;
|
||||
private float m_collisionSoundVolume;
|
||||
|
||||
#endregion Fields
|
||||
|
||||
@@ -269,9 +274,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public SceneObjectPart()
|
||||
{
|
||||
// It's not necessary to persist this
|
||||
m_TextureAnimation = new byte[0];
|
||||
m_particleSystem = new byte[0];
|
||||
Rezzed = DateTime.Now;
|
||||
m_TextureAnimation = Utils.EmptyBytes;
|
||||
m_particleSystem = Utils.EmptyBytes;
|
||||
Rezzed = DateTime.UtcNow;
|
||||
|
||||
m_inventory = new SceneObjectPartInventory(this);
|
||||
}
|
||||
@@ -290,8 +295,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_name = "Primitive";
|
||||
|
||||
Rezzed = DateTime.Now;
|
||||
_creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
Rezzed = DateTime.UtcNow;
|
||||
_creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
|
||||
_ownerID = ownerID;
|
||||
_creatorID = _ownerID;
|
||||
_lastOwnerID = UUID.Zero;
|
||||
@@ -299,19 +304,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
Shape = shape;
|
||||
// Todo: Add More Object Parameter from above!
|
||||
_ownershipCost = 0;
|
||||
_objectSaleType = (byte) 0;
|
||||
_objectSaleType = 0;
|
||||
_salePrice = 0;
|
||||
_category = (uint) 0;
|
||||
_category = 0;
|
||||
_lastOwnerID = _creatorID;
|
||||
// End Todo: ///
|
||||
GroupPosition = groupPosition;
|
||||
OffsetPosition = offsetPosition;
|
||||
RotationOffset = rotationOffset;
|
||||
Velocity = new Vector3(0, 0, 0);
|
||||
AngularVelocity = new Vector3(0, 0, 0);
|
||||
Acceleration = new Vector3(0, 0, 0);
|
||||
m_TextureAnimation = new byte[0];
|
||||
m_particleSystem = new byte[0];
|
||||
Velocity = Vector3.Zero;
|
||||
AngularVelocity = Vector3.Zero;
|
||||
Acceleration = Vector3.Zero;
|
||||
m_TextureAnimation = Utils.EmptyBytes;
|
||||
m_particleSystem = Utils.EmptyBytes;
|
||||
|
||||
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
|
||||
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
|
||||
@@ -532,13 +537,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Root prim actually goes at Position
|
||||
if (_parentID == 0)
|
||||
{
|
||||
PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
PhysActor.Position = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// To move the child prim in respect to the group position and rotation we have to calculate
|
||||
Vector3 resultingposition = GetWorldPosition();
|
||||
PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
|
||||
PhysActor.Position = resultingposition;
|
||||
Quaternion resultingrot = GetWorldRotation();
|
||||
PhysActor.Orientation = resultingrot;
|
||||
}
|
||||
@@ -580,7 +585,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (_parentID != 0 && PhysActor != null)
|
||||
{
|
||||
Vector3 resultingposition = GetWorldPosition();
|
||||
PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
|
||||
PhysActor.Position = resultingposition;
|
||||
Quaternion resultingrot = GetWorldRotation();
|
||||
PhysActor.Orientation = resultingrot;
|
||||
|
||||
@@ -670,7 +675,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (PhysActor.IsPhysical)
|
||||
{
|
||||
PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
PhysActor.Velocity = value;
|
||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
||||
}
|
||||
}
|
||||
@@ -812,7 +817,7 @@ if (m_shape != null) {
|
||||
{
|
||||
if (m_parentGroup.Scene.PhysicsScene != null)
|
||||
{
|
||||
PhysActor.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z);
|
||||
PhysActor.Size = m_shape.Scale;
|
||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
||||
}
|
||||
}
|
||||
@@ -1077,8 +1082,8 @@ if (m_shape != null) {
|
||||
|
||||
private void SendObjectPropertiesToClient(UUID AgentID)
|
||||
{
|
||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
{
|
||||
// Ugly reference :(
|
||||
if (avatars[i].UUID == AgentID)
|
||||
@@ -1140,8 +1145,8 @@ if (m_shape != null) {
|
||||
/// </summary>
|
||||
public void AddFullUpdateToAllAvatars()
|
||||
{
|
||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
{
|
||||
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
||||
}
|
||||
@@ -1165,8 +1170,8 @@ if (m_shape != null) {
|
||||
/// Terse updates
|
||||
public void AddTerseUpdateToAllAvatars()
|
||||
{
|
||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
{
|
||||
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
||||
}
|
||||
@@ -1220,7 +1225,7 @@ if (m_shape != null) {
|
||||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||
public void ApplyImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||
{
|
||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
||||
Vector3 impulse = impulsei;
|
||||
|
||||
if (localGlobalTF)
|
||||
{
|
||||
@@ -1228,7 +1233,7 @@ if (m_shape != null) {
|
||||
Quaternion AXgrot = grot;
|
||||
Vector3 AXimpulsei = impulsei;
|
||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
||||
impulse = newimpulse;
|
||||
}
|
||||
|
||||
if (m_parentGroup != null)
|
||||
@@ -1246,7 +1251,7 @@ if (m_shape != null) {
|
||||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||
public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||
{
|
||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
||||
Vector3 impulse = impulsei;
|
||||
|
||||
if (localGlobalTF)
|
||||
{
|
||||
@@ -1254,7 +1259,7 @@ if (m_shape != null) {
|
||||
Quaternion AXgrot = grot;
|
||||
Vector3 AXimpulsei = impulsei;
|
||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
||||
impulse = newimpulse;
|
||||
}
|
||||
|
||||
if (m_parentGroup != null)
|
||||
@@ -1272,7 +1277,7 @@ if (m_shape != null) {
|
||||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||
public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||
{
|
||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
||||
Vector3 impulse = impulsei;
|
||||
|
||||
if (localGlobalTF)
|
||||
{
|
||||
@@ -1280,7 +1285,7 @@ if (m_shape != null) {
|
||||
Quaternion AXgrot = grot;
|
||||
Vector3 AXimpulsei = impulsei;
|
||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
||||
impulse = newimpulse;
|
||||
}
|
||||
|
||||
if (m_parentGroup != null)
|
||||
@@ -1328,8 +1333,8 @@ if (m_shape != null) {
|
||||
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||
Name,
|
||||
Shape,
|
||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
||||
AbsolutePosition,
|
||||
Scale,
|
||||
RotationOffset,
|
||||
RigidBody);
|
||||
|
||||
@@ -1518,7 +1523,7 @@ if (m_shape != null) {
|
||||
PhysicsJoint joint;
|
||||
|
||||
joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
|
||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
||||
AbsolutePosition,
|
||||
this.RotationOffset,
|
||||
Description,
|
||||
bodyNames,
|
||||
@@ -1703,12 +1708,12 @@ if (m_shape != null) {
|
||||
}
|
||||
}
|
||||
|
||||
public PhysicsVector GetForce()
|
||||
public Vector3 GetForce()
|
||||
{
|
||||
if (PhysActor != null)
|
||||
return PhysActor.Force;
|
||||
else
|
||||
return new PhysicsVector();
|
||||
return Vector3.Zero;
|
||||
}
|
||||
|
||||
public void GetProperties(IClientAPI client)
|
||||
@@ -1894,24 +1899,24 @@ if (m_shape != null) {
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
if (avlist != null)
|
||||
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < avlist.Length; i++)
|
||||
{
|
||||
foreach (ScenePresence av in avlist)
|
||||
ScenePresence av = avlist[i];
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
detobj.nameStr = av.ControllingClient.Name;
|
||||
detobj.ownerUUID = av.UUID;
|
||||
detobj.posVector = av.AbsolutePosition;
|
||||
detobj.rotQuat = av.Rotation;
|
||||
detobj.velVector = av.Velocity;
|
||||
detobj.colliderType = 0;
|
||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||
colliding.Add(detobj);
|
||||
}
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
detobj.nameStr = av.ControllingClient.Name;
|
||||
detobj.ownerUUID = av.UUID;
|
||||
detobj.posVector = av.AbsolutePosition;
|
||||
detobj.rotQuat = av.Rotation;
|
||||
detobj.velVector = av.Velocity;
|
||||
detobj.colliderType = 0;
|
||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||
colliding.Add(detobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1965,26 +1970,25 @@ if (m_shape != null) {
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
if (avlist != null)
|
||||
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < avlist.Length; i++)
|
||||
{
|
||||
foreach (ScenePresence av in avlist)
|
||||
{
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
detobj.nameStr = av.Name;
|
||||
detobj.ownerUUID = av.UUID;
|
||||
detobj.posVector = av.AbsolutePosition;
|
||||
detobj.rotQuat = av.Rotation;
|
||||
detobj.velVector = av.Velocity;
|
||||
detobj.colliderType = 0;
|
||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||
colliding.Add(detobj);
|
||||
}
|
||||
}
|
||||
ScenePresence av = avlist[i];
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
detobj.nameStr = av.Name;
|
||||
detobj.ownerUUID = av.UUID;
|
||||
detobj.posVector = av.AbsolutePosition;
|
||||
detobj.rotQuat = av.Rotation;
|
||||
detobj.velVector = av.Velocity;
|
||||
detobj.colliderType = 0;
|
||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||
colliding.Add(detobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2035,24 +2039,24 @@ if (m_shape != null) {
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
if (avlist != null)
|
||||
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||
|
||||
for (int i = 0; i < avlist.Length; i++)
|
||||
{
|
||||
foreach (ScenePresence av in avlist)
|
||||
ScenePresence av = avlist[i];
|
||||
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
if (av.LocalId == localId)
|
||||
{
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
detobj.nameStr = av.Name;
|
||||
detobj.ownerUUID = av.UUID;
|
||||
detobj.posVector = av.AbsolutePosition;
|
||||
detobj.rotQuat = av.Rotation;
|
||||
detobj.velVector = av.Velocity;
|
||||
detobj.colliderType = 0;
|
||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||
colliding.Add(detobj);
|
||||
}
|
||||
DetectedObject detobj = new DetectedObject();
|
||||
detobj.keyUUID = av.UUID;
|
||||
detobj.nameStr = av.Name;
|
||||
detobj.ownerUUID = av.UUID;
|
||||
detobj.posVector = av.AbsolutePosition;
|
||||
detobj.rotQuat = av.Rotation;
|
||||
detobj.velVector = av.Velocity;
|
||||
detobj.colliderType = 0;
|
||||
detobj.groupUUID = av.ControllingClient.ActiveGroupId;
|
||||
colliding.Add(detobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2074,7 +2078,7 @@ if (m_shape != null) {
|
||||
}
|
||||
}
|
||||
|
||||
public void PhysicsOutOfBounds(PhysicsVector pos)
|
||||
public void PhysicsOutOfBounds(Vector3 pos)
|
||||
{
|
||||
m_log.Error("[PHYSICS]: Physical Object went out of bounds.");
|
||||
|
||||
@@ -2317,8 +2321,8 @@ if (m_shape != null) {
|
||||
/// </summary>
|
||||
public void SendFullUpdateToAllClients()
|
||||
{
|
||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
{
|
||||
// Ugly reference :(
|
||||
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
|
||||
@@ -2328,8 +2332,8 @@ if (m_shape != null) {
|
||||
|
||||
public void SendFullUpdateToAllClientsExcept(UUID agentID)
|
||||
{
|
||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
{
|
||||
// Ugly reference :(
|
||||
if (avatars[i].UUID != agentID)
|
||||
@@ -2394,18 +2398,36 @@ if (m_shape != null) {
|
||||
/// </summary>
|
||||
public void SendScheduledUpdates()
|
||||
{
|
||||
if (m_updateFlag == 1) //some change has been made so update the clients
|
||||
{
|
||||
AddTerseUpdateToAllAvatars();
|
||||
ClearUpdateSchedule();
|
||||
const float VELOCITY_TOLERANCE = 0.01f;
|
||||
const float POSITION_TOLERANCE = 0.1f;
|
||||
|
||||
// This causes the Scene to 'poll' physical objects every couple of frames
|
||||
// bad, so it's been replaced by an event driven method.
|
||||
//if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
|
||||
//{
|
||||
// Only send the constant terse updates on physical objects!
|
||||
//ScheduleTerseUpdate();
|
||||
//}
|
||||
if (m_updateFlag == 1)
|
||||
{
|
||||
// Throw away duplicate or insignificant updates
|
||||
if (RotationOffset != m_lastRotation ||
|
||||
Acceleration != m_lastAcceleration ||
|
||||
(Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE ||
|
||||
(RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE ||
|
||||
(OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE)
|
||||
{
|
||||
AddTerseUpdateToAllAvatars();
|
||||
ClearUpdateSchedule();
|
||||
|
||||
// This causes the Scene to 'poll' physical objects every couple of frames
|
||||
// bad, so it's been replaced by an event driven method.
|
||||
//if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
|
||||
//{
|
||||
// Only send the constant terse updates on physical objects!
|
||||
//ScheduleTerseUpdate();
|
||||
//}
|
||||
|
||||
// Update the "last" values
|
||||
m_lastPosition = OffsetPosition;
|
||||
m_lastRotation = RotationOffset;
|
||||
m_lastVelocity = Velocity;
|
||||
m_lastAcceleration = Acceleration;
|
||||
m_lastAngularVelocity = RotationalVelocity;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2472,8 +2494,8 @@ if (m_shape != null) {
|
||||
/// </summary>
|
||||
public void SendTerseUpdateToAllClients()
|
||||
{
|
||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||
for (int i = 0; i < avatars.Length; i++)
|
||||
{
|
||||
SendTerseUpdateToClient(avatars[i].ControllingClient);
|
||||
}
|
||||
@@ -2547,7 +2569,7 @@ if (m_shape != null) {
|
||||
}
|
||||
}
|
||||
|
||||
public void SetForce(PhysicsVector force)
|
||||
public void SetForce(Vector3 force)
|
||||
{
|
||||
if (PhysActor != null)
|
||||
{
|
||||
@@ -2571,7 +2593,7 @@ if (m_shape != null) {
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVehicleVectorParam(int param, PhysicsVector value)
|
||||
public void SetVehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
if (PhysActor != null)
|
||||
{
|
||||
@@ -3420,8 +3442,8 @@ if (m_shape != null) {
|
||||
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||
Name,
|
||||
Shape,
|
||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
||||
AbsolutePosition,
|
||||
Scale,
|
||||
RotationOffset,
|
||||
UsePhysics);
|
||||
|
||||
@@ -3561,7 +3583,7 @@ if (m_shape != null) {
|
||||
// in SL.
|
||||
//
|
||||
if (ParentGroup.RootPart != this)
|
||||
ParentGroup.RootPart.Rezzed = DateTime.Now;
|
||||
ParentGroup.RootPart.Rezzed = DateTime.UtcNow;
|
||||
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
ScheduleFullUpdate();
|
||||
|
||||
Reference in New Issue
Block a user