aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorVegaslon2016-08-26 12:44:14 -0400
committerUbitUmarov2016-08-27 22:02:03 +0100
commitc918dd74dad732619d9496d02a1cc8c5eb51d8d0 (patch)
treed4dab43a3b1d51111e5c7f25190d47d188a61ec5 /OpenSim/Region/Framework/Scenes
parent experimental function. Results still too volatile to be usefull (diff)
downloadopensim-SC-c918dd74dad732619d9496d02a1cc8c5eb51d8d0.zip
opensim-SC-c918dd74dad732619d9496d02a1cc8c5eb51d8d0.tar.gz
opensim-SC-c918dd74dad732619d9496d02a1cc8c5eb51d8d0.tar.bz2
opensim-SC-c918dd74dad732619d9496d02a1cc8c5eb51d8d0.tar.xz
Import plumbing from Halcyon for camera data to physics engine.
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs52
1 files changed, 46 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index db21dba..878381d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -5429,10 +5429,23 @@ namespace OpenSim.Region.Framework.Scenes
5429 } 5429 }
5430 } 5430 }
5431 5431
5432 CameraData physActor_OnPhysicsRequestingCameraData()
5433 {
5434 return new CameraData
5435 {
5436 Valid = true,
5437 CameraPosition = this.CameraPosition,
5438 CameraRotation = this.CameraRotation,
5439 MouseLook = this.m_mouseLook,
5440 HeadRotation = this.m_headrotation,
5441 BodyRotation = this.m_bodyRot
5442 };
5443 }
5444
5432 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID) 5445 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, UUID Script_item_UUID)
5433 { 5446 {
5434 SceneObjectPart p = m_scene.GetSceneObjectPart(Obj_localID); 5447 SceneObjectPart part = m_scene.GetSceneObjectPart(Obj_localID);
5435 if (p == null) 5448 if (part == null)
5436 return; 5449 return;
5437 5450
5438 ControllingClient.SendTakeControls(controls, false, false); 5451 ControllingClient.SendTakeControls(controls, false, false);
@@ -5442,7 +5455,7 @@ namespace OpenSim.Region.Framework.Scenes
5442 obj.ignoreControls = ScriptControlled.CONTROL_ZERO; 5455 obj.ignoreControls = ScriptControlled.CONTROL_ZERO;
5443 obj.eventControls = ScriptControlled.CONTROL_ZERO; 5456 obj.eventControls = ScriptControlled.CONTROL_ZERO;
5444 5457
5445 obj.objectID = p.ParentGroup.UUID; 5458 obj.objectID = part.ParentGroup.UUID;
5446 obj.itemID = Script_item_UUID; 5459 obj.itemID = Script_item_UUID;
5447 if (pass_on == 0 && accept == 0) 5460 if (pass_on == 0 && accept == 0)
5448 { 5461 {
@@ -5470,17 +5483,43 @@ namespace OpenSim.Region.Framework.Scenes
5470 { 5483 {
5471 IgnoredControls &= ~(ScriptControlled)controls; 5484 IgnoredControls &= ~(ScriptControlled)controls;
5472 if (scriptedcontrols.ContainsKey(Script_item_UUID)) 5485 if (scriptedcontrols.ContainsKey(Script_item_UUID))
5473 scriptedcontrols.Remove(Script_item_UUID); 5486 RemoveScriptFromControlNotifications(Script_item_UUID, part);
5474 } 5487 }
5475 else 5488 else
5476 { 5489 {
5477 scriptedcontrols[Script_item_UUID] = obj; 5490 AddScriptToControlNotifications(Script_item_UUID, part, ref obj);
5478 } 5491 }
5479 } 5492 }
5480 5493
5481 ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true); 5494 ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true);
5482 } 5495 }
5483 5496
5497 private void AddScriptToControlNotifications(OpenMetaverse.UUID Script_item_UUID, SceneObjectPart part, ref ScriptControllers obj)
5498 {
5499 scriptedcontrols[Script_item_UUID] = obj;
5500
5501 PhysicsActor physActor = part.ParentGroup.RootPart.PhysActor;
5502 if (physActor != null)
5503 {
5504 physActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData;
5505 physActor.OnPhysicsRequestingCameraData += physActor_OnPhysicsRequestingCameraData;
5506 }
5507 }
5508
5509 private void RemoveScriptFromControlNotifications(OpenMetaverse.UUID Script_item_UUID, SceneObjectPart part)
5510 {
5511 scriptedcontrols.Remove(Script_item_UUID);
5512
5513 if (part != null)
5514 {
5515 PhysicsActor physActor = part.ParentGroup.RootPart.PhysActor;
5516 if (physActor != null)
5517 {
5518 physActor.OnPhysicsRequestingCameraData -= physActor_OnPhysicsRequestingCameraData;
5519 }
5520 }
5521 }
5522
5484 public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID) 5523 public void HandleForceReleaseControls(IClientAPI remoteClient, UUID agentID)
5485 { 5524 {
5486 IgnoredControls = ScriptControlled.CONTROL_ZERO; 5525 IgnoredControls = ScriptControlled.CONTROL_ZERO;
@@ -5518,6 +5557,7 @@ namespace OpenSim.Region.Framework.Scenes
5518 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID) 5557 public void UnRegisterControlEventsToScript(uint Obj_localID, UUID Script_item_UUID)
5519 { 5558 {
5520 ScriptControllers takecontrols; 5559 ScriptControllers takecontrols;
5560 SceneObjectPart part = m_scene.GetSceneObjectPart(Obj_localID);
5521 5561
5522 lock (scriptedcontrols) 5562 lock (scriptedcontrols)
5523 { 5563 {
@@ -5528,7 +5568,7 @@ namespace OpenSim.Region.Framework.Scenes
5528 ControllingClient.SendTakeControls((int)sctc, false, false); 5568 ControllingClient.SendTakeControls((int)sctc, false, false);
5529 ControllingClient.SendTakeControls((int)sctc, true, false); 5569 ControllingClient.SendTakeControls((int)sctc, true, false);
5530 5570
5531 scriptedcontrols.Remove(Script_item_UUID); 5571 RemoveScriptFromControlNotifications(Script_item_UUID, part);
5532 IgnoredControls = ScriptControlled.CONTROL_ZERO; 5572 IgnoredControls = ScriptControlled.CONTROL_ZERO;
5533 foreach (ScriptControllers scData in scriptedcontrols.Values) 5573 foreach (ScriptControllers scData in scriptedcontrols.Values)
5534 { 5574 {