diff options
author | Teravus Ovares | 2008-04-24 11:32:41 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-24 11:32:41 +0000 |
commit | aa8aee90a35458f1f601ca23e2298b212782d0a3 (patch) | |
tree | 37c2645867cba040a4ad7e32d1b5ccd56d155d87 /OpenSim | |
parent | * From: Alan M Webb <awebb.vnet.ibm.com> (diff) | |
download | opensim-SC-aa8aee90a35458f1f601ca23e2298b212782d0a3.zip opensim-SC-aa8aee90a35458f1f601ca23e2298b212782d0a3.tar.gz opensim-SC-aa8aee90a35458f1f601ca23e2298b212782d0a3.tar.bz2 opensim-SC-aa8aee90a35458f1f601ca23e2298b212782d0a3.tar.xz |
* Adds much better support for attachments that you right click on in world.
* Your friends can see your attachments now. People who appear in the sim after you've attached something can also see your attachments.
* You can position & rotate your attachments now. Positions do *not* save.
* You can detach attachments now the regular way.
* Attachments do not cross into other regions with you..(this isn't too far off)
* Updated ODE to not request terse updates on child prim.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 32 |
8 files changed, 176 insertions, 26 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 4faaad6..28047e7 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -454,6 +454,7 @@ namespace OpenSim.Framework | |||
454 | event AvatarNowWearing OnAvatarNowWearing; | 454 | event AvatarNowWearing OnAvatarNowWearing; |
455 | event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 455 | event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
456 | event ObjectAttach OnObjectAttach; | 456 | event ObjectAttach OnObjectAttach; |
457 | event ObjectDeselect OnObjectDetach; | ||
457 | event StartAnim OnStartAnim; | 458 | event StartAnim OnStartAnim; |
458 | event StopAnim OnStopAnim; | 459 | event StopAnim OnStopAnim; |
459 | event LinkObjects OnLinkObjects; | 460 | event LinkObjects OnLinkObjects; |
@@ -638,7 +639,8 @@ namespace OpenSim.Framework | |||
638 | 639 | ||
639 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, | 640 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, |
640 | LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, | 641 | LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, |
641 | uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction, byte[] textureanimation); | 642 | uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction, byte[] textureanimation, |
643 | bool attachment, uint AttachmentPoint); | ||
642 | 644 | ||
643 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, | 645 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, |
644 | LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, | 646 | LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 216633f..0a6431d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -235,6 +235,7 @@ namespace OpenSim.Region.ClientStack | |||
235 | 235 | ||
236 | private ScriptAnswer handlerScriptAnswer = null; | 236 | private ScriptAnswer handlerScriptAnswer = null; |
237 | private RequestPayPrice handlerRequestPayPrice = null; | 237 | private RequestPayPrice handlerRequestPayPrice = null; |
238 | private ObjectDeselect handlerObjectDetach = null; | ||
238 | 239 | ||
239 | /* Properties */ | 240 | /* Properties */ |
240 | 241 | ||
@@ -689,6 +690,7 @@ namespace OpenSim.Region.ClientStack | |||
689 | public event AvatarNowWearing OnAvatarNowWearing; | 690 | public event AvatarNowWearing OnAvatarNowWearing; |
690 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 691 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
691 | public event ObjectAttach OnObjectAttach; | 692 | public event ObjectAttach OnObjectAttach; |
693 | public event ObjectDeselect OnObjectDetach; | ||
692 | public event GenericCall2 OnCompleteMovementToRegion; | 694 | public event GenericCall2 OnCompleteMovementToRegion; |
693 | public event UpdateAgent OnAgentUpdate; | 695 | public event UpdateAgent OnAgentUpdate; |
694 | public event AgentRequestSit OnAgentRequestSit; | 696 | public event AgentRequestSit OnAgentRequestSit; |
@@ -1989,6 +1991,7 @@ namespace OpenSim.Region.ClientStack | |||
1989 | /// <param name="attachPoint"></param> | 1991 | /// <param name="attachPoint"></param> |
1990 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) | 1992 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) |
1991 | { | 1993 | { |
1994 | |||
1992 | ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); | 1995 | ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); |
1993 | Console.WriteLine("Attach object!"); | 1996 | Console.WriteLine("Attach object!"); |
1994 | // TODO: don't create new blocks if recycling an old packet | 1997 | // TODO: don't create new blocks if recycling an old packet |
@@ -2013,13 +2016,13 @@ namespace OpenSim.Region.ClientStack | |||
2013 | 2016 | ||
2014 | SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, flags, | 2017 | SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, flags, |
2015 | objectID, ownerID, text, color, parentID, particleSystem, | 2018 | objectID, ownerID, text, color, parentID, particleSystem, |
2016 | rotation, clickAction, textureanim); | 2019 | rotation, clickAction, textureanim, false,(uint)0); |
2017 | } | 2020 | } |
2018 | public void SendPrimitiveToClient( | 2021 | public void SendPrimitiveToClient( |
2019 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, | 2022 | ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, |
2020 | uint flags, | 2023 | uint flags, |
2021 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, | 2024 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, |
2022 | LLQuaternion rotation, byte clickAction, byte[] textureanim) | 2025 | LLQuaternion rotation, byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint) |
2023 | { | 2026 | { |
2024 | ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | 2027 | ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
2025 | // TODO: don't create new blocks if recycling an old packet | 2028 | // TODO: don't create new blocks if recycling an old packet |
@@ -2050,6 +2053,18 @@ namespace OpenSim.Region.ClientStack | |||
2050 | outPacket.ObjectData[0].ClickAction = clickAction; | 2053 | outPacket.ObjectData[0].ClickAction = clickAction; |
2051 | //outPacket.ObjectData[0].Flags = 0; | 2054 | //outPacket.ObjectData[0].Flags = 0; |
2052 | 2055 | ||
2056 | if (attachment) | ||
2057 | { | ||
2058 | // Necessary??? | ||
2059 | outPacket.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 2); | ||
2060 | outPacket.ObjectData[0].JointPivot = new LLVector3(0, 0, 0); | ||
2061 | |||
2062 | // Item from inventory??? | ||
2063 | outPacket.ObjectData[0].NameValue = | ||
2064 | Helpers.StringToField("AttachItemID STRING RW SV " + objectID.UUID); | ||
2065 | outPacket.ObjectData[0].State = (byte)(((byte)AttachPoint) << 4); | ||
2066 | } | ||
2067 | |||
2053 | // Sound Radius | 2068 | // Sound Radius |
2054 | outPacket.ObjectData[0].Radius = 20; | 2069 | outPacket.ObjectData[0].Radius = 20; |
2055 | 2070 | ||
@@ -3438,6 +3453,21 @@ namespace OpenSim.Region.ClientStack | |||
3438 | } | 3453 | } |
3439 | 3454 | ||
3440 | break; | 3455 | break; |
3456 | case PacketType.ObjectDetach: | ||
3457 | |||
3458 | ObjectDetachPacket dett = (ObjectDetachPacket)Pack; | ||
3459 | for (int j = 0; j < dett.ObjectData.Length; j++) | ||
3460 | { | ||
3461 | uint obj = dett.ObjectData[j].ObjectLocalID; | ||
3462 | handlerObjectDetach = OnObjectDetach; | ||
3463 | if (handlerObjectDetach != null) | ||
3464 | { | ||
3465 | handlerObjectDetach(obj,this); | ||
3466 | } | ||
3467 | |||
3468 | } | ||
3469 | |||
3470 | break; | ||
3441 | case PacketType.SetAlwaysRun: | 3471 | case PacketType.SetAlwaysRun: |
3442 | SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; | 3472 | SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; |
3443 | 3473 | ||
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 2b28b2a..668e50f 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -293,9 +293,46 @@ namespace OpenSim.Region.Environment.Scenes | |||
293 | } | 293 | } |
294 | } | 294 | } |
295 | } | 295 | } |
296 | public void DetachObject(uint objectLocalID, IClientAPI remoteClient) | ||
297 | { | ||
298 | List<EntityBase> EntityList = GetEntities(); | ||
296 | 299 | ||
300 | foreach (EntityBase obj in EntityList) | ||
301 | { | ||
302 | if (obj is SceneObjectGroup) | ||
303 | { | ||
304 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) | ||
305 | { | ||
306 | SceneObjectGroup group = (SceneObjectGroup)obj; | ||
307 | group.DetachToGround(); | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | |||
312 | } | ||
297 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot) | 313 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot) |
298 | { | 314 | { |
315 | List<EntityBase> EntityList = GetEntities(); | ||
316 | |||
317 | foreach (EntityBase obj in EntityList) | ||
318 | { | ||
319 | if (obj is SceneObjectGroup) | ||
320 | { | ||
321 | if (((SceneObjectGroup)obj).LocalId == objectLocalID) | ||
322 | { | ||
323 | SceneObjectGroup group = (SceneObjectGroup)obj; | ||
324 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt); | ||
325 | |||
326 | } | ||
327 | |||
328 | } | ||
329 | } | ||
330 | |||
331 | } | ||
332 | // Use the above method. | ||
333 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot, | ||
334 | bool deadMethod) | ||
335 | { | ||
299 | Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); | 336 | Console.WriteLine("Attaching object " + objectLocalID + " to " + AttachmentPt); |
300 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); | 337 | SceneObjectPart p = GetSceneObjectPart(objectLocalID); |
301 | if (p != null) | 338 | if (p != null) |
@@ -1005,15 +1042,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
1005 | SceneObjectGroup group = GetGroupByPrim(localID); | 1042 | SceneObjectGroup group = GetGroupByPrim(localID); |
1006 | if (group != null) | 1043 | if (group != null) |
1007 | { | 1044 | { |
1045 | |||
1008 | LLVector3 oldPos = group.AbsolutePosition; | 1046 | LLVector3 oldPos = group.AbsolutePosition; |
1009 | if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos)) | 1047 | if (group.RootPart.m_IsAttachment) |
1010 | { | 1048 | { |
1011 | group.SendGroupTerseUpdate(); | 1049 | group.UpdateGroupPosition(pos); |
1012 | return; | ||
1013 | } | 1050 | } |
1014 | if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | 1051 | else |
1015 | { | 1052 | { |
1016 | group.UpdateGroupPosition(pos); | 1053 | if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos)) |
1054 | { | ||
1055 | group.SendGroupTerseUpdate(); | ||
1056 | return; | ||
1057 | } | ||
1058 | if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) | ||
1059 | { | ||
1060 | group.UpdateGroupPosition(pos); | ||
1061 | } | ||
1017 | } | 1062 | } |
1018 | } | 1063 | } |
1019 | } | 1064 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index c41a445..21c8991 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1528,6 +1528,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1528 | client.OnRezObject += RezObject; | 1528 | client.OnRezObject += RezObject; |
1529 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; | 1529 | client.OnRezSingleAttachmentFromInv += RezSingleAttachment; |
1530 | client.OnObjectAttach += m_innerScene.AttachObject; | 1530 | client.OnObjectAttach += m_innerScene.AttachObject; |
1531 | client.OnObjectDetach += m_innerScene.DetachObject; | ||
1531 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; | 1532 | client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; |
1532 | client.OnObjectDescription += m_innerScene.PrimDescription; | 1533 | client.OnObjectDescription += m_innerScene.PrimDescription; |
1533 | client.OnObjectName += m_innerScene.PrimName; | 1534 | client.OnObjectName += m_innerScene.PrimName; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 4f65cc7..27639ea 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -180,7 +180,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
180 | set | 180 | set |
181 | { | 181 | { |
182 | LLVector3 val = value; | 182 | LLVector3 val = value; |
183 | if (val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) | 183 | if ((val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f) && !m_rootPart.m_IsAttachment) |
184 | { | 184 | { |
185 | m_scene.CrossPrimGroupIntoNewRegion(val, this); | 185 | m_scene.CrossPrimGroupIntoNewRegion(val, this); |
186 | } | 186 | } |
@@ -612,6 +612,42 @@ namespace OpenSim.Region.Environment.Scenes | |||
612 | m_rootPart = part; | 612 | m_rootPart = part; |
613 | } | 613 | } |
614 | 614 | ||
615 | |||
616 | public void AttachToAgent(LLUUID agentID, uint attachmentpoint) | ||
617 | { | ||
618 | ScenePresence avatar = m_scene.GetScenePresence(agentID); | ||
619 | if (avatar != null) | ||
620 | { | ||
621 | m_rootPart.m_attachedAvatar = agentID; | ||
622 | m_rootPart.SetParentLocalId(avatar.LocalId); | ||
623 | m_rootPart.SetAttachmentPoint(attachmentpoint); | ||
624 | m_rootPart.m_IsAttachment = true; | ||
625 | if (m_rootPart.PhysActor != null) | ||
626 | { | ||
627 | m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); | ||
628 | m_rootPart.PhysActor = null; | ||
629 | AbsolutePosition = LLVector3.Zero; | ||
630 | } | ||
631 | m_rootPart.ScheduleFullUpdate(); | ||
632 | } | ||
633 | } | ||
634 | |||
635 | public void DetachToGround() | ||
636 | { | ||
637 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.m_attachedAvatar); | ||
638 | LLVector3 detachedpos = new LLVector3(127f,127f,127f); | ||
639 | if (avatar != null) | ||
640 | { | ||
641 | detachedpos = avatar.AbsolutePosition; | ||
642 | } | ||
643 | AbsolutePosition = detachedpos; | ||
644 | m_rootPart.m_attachedAvatar = LLUUID.Zero; | ||
645 | m_rootPart.SetParentLocalId(0); | ||
646 | m_rootPart.SetAttachmentPoint((byte)0); | ||
647 | m_rootPart.m_IsAttachment = false; | ||
648 | m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_scene.m_physicalPrim); | ||
649 | m_rootPart.ScheduleFullUpdate(); | ||
650 | } | ||
615 | /// <summary> | 651 | /// <summary> |
616 | /// | 652 | /// |
617 | /// </summary> | 653 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index e2cb3ac..099d0f0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -99,6 +99,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
99 | // TODO: This needs to be persisted in next XML version update! | 99 | // TODO: This needs to be persisted in next XML version update! |
100 | [XmlIgnore] public int[] PayPrice = {0,0,0,0,0}; | 100 | [XmlIgnore] public int[] PayPrice = {0,0,0,0,0}; |
101 | 101 | ||
102 | |||
103 | [XmlIgnore] public bool m_IsAttachment = false; | ||
104 | [XmlIgnore] public uint m_attachmentPoint = (byte)0; | ||
105 | [XmlIgnore] public LLUUID m_attachedAvatar = LLUUID.Zero; | ||
106 | |||
102 | public Int32 CreationDate; | 107 | public Int32 CreationDate; |
103 | public uint ParentID = 0; | 108 | public uint ParentID = 0; |
104 | 109 | ||
@@ -1271,7 +1276,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1271 | } | 1276 | } |
1272 | return returnresult; | 1277 | return returnresult; |
1273 | } | 1278 | } |
1279 | |||
1280 | // Use this for attachments! LocalID should be avatar's localid | ||
1281 | public void SetParentLocalId(uint localID) | ||
1282 | { | ||
1283 | ParentID = localID; | ||
1284 | } | ||
1274 | 1285 | ||
1286 | public void SetAttachmentPoint(uint AttachmentPoint) | ||
1287 | { | ||
1288 | m_attachmentPoint = AttachmentPoint; | ||
1289 | } | ||
1275 | /// <summary> | 1290 | /// <summary> |
1276 | /// | 1291 | /// |
1277 | /// </summary> | 1292 | /// </summary> |
@@ -2212,7 +2227,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2212 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; | 2227 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; |
2213 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, lPos, clientFlags, m_uuid, | 2228 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, lPos, clientFlags, m_uuid, |
2214 | OwnerID, | 2229 | OwnerID, |
2215 | m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation); | 2230 | m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation, m_IsAttachment, m_attachmentPoint); |
2216 | } | 2231 | } |
2217 | 2232 | ||
2218 | /// Terse updates | 2233 | /// Terse updates |
@@ -2271,15 +2286,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
2271 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) | 2286 | public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) |
2272 | { | 2287 | { |
2273 | LLQuaternion mRot = RotationOffset; | 2288 | LLQuaternion mRot = RotationOffset; |
2274 | if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0) | 2289 | if (m_IsAttachment) |
2275 | { | 2290 | { |
2276 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Shape.State); | 2291 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, (byte)(((byte)m_attachmentPoint) << 4)); |
2277 | } | 2292 | } |
2278 | else | 2293 | else |
2279 | { | 2294 | { |
2280 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, | 2295 | if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) |
2281 | RotationalVelocity); | 2296 | { |
2282 | //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | 2297 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Shape.State); |
2298 | } | ||
2299 | else | ||
2300 | { | ||
2301 | remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, | ||
2302 | RotationalVelocity); | ||
2303 | //System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString()); | ||
2304 | } | ||
2283 | } | 2305 | } |
2284 | } | 2306 | } |
2285 | 2307 | ||
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index c4409bc..0aa3240 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -61,6 +61,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
61 | public event AvatarNowWearing OnAvatarNowWearing; | 61 | public event AvatarNowWearing OnAvatarNowWearing; |
62 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 62 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
63 | public event ObjectAttach OnObjectAttach; | 63 | public event ObjectAttach OnObjectAttach; |
64 | public event ObjectDeselect OnObjectDetach; | ||
64 | public event StartAnim OnStartAnim; | 65 | public event StartAnim OnStartAnim; |
65 | public event StopAnim OnStopAnim; | 66 | public event StopAnim OnStopAnim; |
66 | public event LinkObjects OnLinkObjects; | 67 | public event LinkObjects OnLinkObjects; |
@@ -380,7 +381,8 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
380 | PrimitiveBaseShape primShape, LLVector3 pos, uint flags, | 381 | PrimitiveBaseShape primShape, LLVector3 pos, uint flags, |
381 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, | 382 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, |
382 | uint parentID, | 383 | uint parentID, |
383 | byte[] particleSystem, LLQuaternion rotation, byte clickAction, byte[] textureanimation) | 384 | byte[] particleSystem, LLQuaternion rotation, byte clickAction, byte[] textureanimation, |
385 | bool attachment, uint AttachmentPoint) | ||
384 | { | 386 | { |
385 | } | 387 | } |
386 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, | 388 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 7a9734c..947466f 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -819,7 +819,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
819 | if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim) | 819 | if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim) |
820 | { | 820 | { |
821 | OdePrim obj = (OdePrim)m_taintparent; | 821 | OdePrim obj = (OdePrim)m_taintparent; |
822 | if (obj.Body != (IntPtr)0 && Body != (IntPtr)0) | 822 | if (obj.Body != (IntPtr)0 && Body != (IntPtr)0 && obj.Body != Body) |
823 | { | 823 | { |
824 | _linkJointGroup = d.JointGroupCreate(0); | 824 | _linkJointGroup = d.JointGroupCreate(0); |
825 | m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup); | 825 | m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup); |
@@ -1098,7 +1098,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1098 | if (_parent != null) | 1098 | if (_parent != null) |
1099 | { | 1099 | { |
1100 | OdePrim odParent = (OdePrim)_parent; | 1100 | OdePrim odParent = (OdePrim)_parent; |
1101 | if (Body != (IntPtr)0 && odParent.Body != (IntPtr)0) | 1101 | if (Body != (IntPtr)0 && odParent.Body != (IntPtr)0 && Body != odParent.Body) |
1102 | { | 1102 | { |
1103 | m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup); | 1103 | m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup); |
1104 | d.JointAttach(m_linkJoint, Body, odParent.Body); | 1104 | d.JointAttach(m_linkJoint, Body, odParent.Body); |
@@ -1978,12 +1978,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1978 | { | 1978 | { |
1979 | _position = l_position; | 1979 | _position = l_position; |
1980 | //_parent_scene.remActivePrim(this); | 1980 | //_parent_scene.remActivePrim(this); |
1981 | base.RequestPhysicsterseUpdate(); | 1981 | if (_parent == null) |
1982 | base.RequestPhysicsterseUpdate(); | ||
1982 | return; | 1983 | return; |
1983 | } | 1984 | } |
1984 | else | 1985 | else |
1985 | { | 1986 | { |
1986 | base.RaiseOutOfBounds(l_position); | 1987 | if (_parent == null) |
1988 | base.RaiseOutOfBounds(l_position); | ||
1987 | return; | 1989 | return; |
1988 | } | 1990 | } |
1989 | } | 1991 | } |
@@ -1998,7 +2000,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1998 | 2000 | ||
1999 | 2001 | ||
2000 | //IsPhysical = false; | 2002 | //IsPhysical = false; |
2001 | base.RaiseOutOfBounds(_position); | 2003 | if (_parent == null) |
2004 | base.RaiseOutOfBounds(_position); | ||
2002 | 2005 | ||
2003 | _acceleration.X = 0; | 2006 | _acceleration.X = 0; |
2004 | _acceleration.Y = 0; | 2007 | _acceleration.Y = 0; |
@@ -2010,7 +2013,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2010 | m_rotationalVelocity.X = 0; | 2013 | m_rotationalVelocity.X = 0; |
2011 | m_rotationalVelocity.Y = 0; | 2014 | m_rotationalVelocity.Y = 0; |
2012 | m_rotationalVelocity.Z = 0; | 2015 | m_rotationalVelocity.Z = 0; |
2013 | base.RequestPhysicsterseUpdate(); | 2016 | |
2017 | if (_parent == null) | ||
2018 | base.RequestPhysicsterseUpdate(); | ||
2019 | |||
2014 | m_throttleUpdates = false; | 2020 | m_throttleUpdates = false; |
2015 | throttleCounter = 0; | 2021 | throttleCounter = 0; |
2016 | _zeroFlag = true; | 2022 | _zeroFlag = true; |
@@ -2054,14 +2060,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2054 | m_throttleUpdates = false; | 2060 | m_throttleUpdates = false; |
2055 | throttleCounter = 0; | 2061 | throttleCounter = 0; |
2056 | m_rotationalVelocity = pv; | 2062 | m_rotationalVelocity = pv; |
2057 | base.RequestPhysicsterseUpdate(); | 2063 | |
2064 | if (_parent == null) | ||
2065 | base.RequestPhysicsterseUpdate(); | ||
2066 | |||
2058 | m_lastUpdateSent = true; | 2067 | m_lastUpdateSent = true; |
2059 | } | 2068 | } |
2060 | } | 2069 | } |
2061 | else | 2070 | else |
2062 | { | 2071 | { |
2063 | if (lastZeroFlag != _zeroFlag) | 2072 | if (lastZeroFlag != _zeroFlag) |
2064 | base.RequestPhysicsterseUpdate(); | 2073 | { |
2074 | if (_parent == null) | ||
2075 | base.RequestPhysicsterseUpdate(); | ||
2076 | } | ||
2065 | 2077 | ||
2066 | m_lastVelocity = _velocity; | 2078 | m_lastVelocity = _velocity; |
2067 | 2079 | ||
@@ -2092,8 +2104,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2092 | m_lastUpdateSent = false; | 2104 | m_lastUpdateSent = false; |
2093 | if (!m_throttleUpdates || throttleCounter > 15) | 2105 | if (!m_throttleUpdates || throttleCounter > 15) |
2094 | { | 2106 | { |
2095 | 2107 | if (_parent == null) | |
2096 | base.RequestPhysicsterseUpdate(); | 2108 | base.RequestPhysicsterseUpdate(); |
2097 | } | 2109 | } |
2098 | else | 2110 | else |
2099 | { | 2111 | { |