diff options
author | UbitUmarov | 2018-12-11 17:23:55 +0000 |
---|---|---|
committer | UbitUmarov | 2018-12-11 17:23:55 +0000 |
commit | af2a9d9508e08f1493858c27ad90f682b58e1ae4 (patch) | |
tree | 09de59564c144abdcd6f430a205a7309be0fb09a /OpenSim/Region/PhysicsModules/ubOde | |
parent | Return a fake openid token to enable web services on a grid to identify the user (diff) | |
download | opensim-SC-af2a9d9508e08f1493858c27ad90f682b58e1ae4.zip opensim-SC-af2a9d9508e08f1493858c27ad90f682b58e1ae4.tar.gz opensim-SC-af2a9d9508e08f1493858c27ad90f682b58e1ae4.tar.bz2 opensim-SC-af2a9d9508e08f1493858c27ad90f682b58e1ae4.tar.xz |
mantis 8420: ubOde awake up lazy body
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 68 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 62 |
2 files changed, 73 insertions, 57 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 4e18522..842bc0b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -3380,7 +3380,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3380 | { | 3380 | { |
3381 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | 3381 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); |
3382 | SafeNativeMethods.BodyEnable(Body); | 3382 | SafeNativeMethods.BodyEnable(Body); |
3383 | } | 3383 | } |
3384 | } | 3384 | } |
3385 | } | 3385 | } |
3386 | m_collisionscore = 0; | 3386 | m_collisionscore = 0; |
@@ -3504,6 +3504,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3504 | return; | 3504 | return; |
3505 | 3505 | ||
3506 | m_vehicle.ProcessFloatVehicleParam((Vehicle)fp.param, fp.value); | 3506 | m_vehicle.ProcessFloatVehicleParam((Vehicle)fp.param, fp.value); |
3507 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3508 | { | ||
3509 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3510 | SafeNativeMethods.BodyEnable(Body); | ||
3511 | } | ||
3507 | } | 3512 | } |
3508 | 3513 | ||
3509 | private void changeVehicleVectorParam(strVehicleVectorParam vp) | 3514 | private void changeVehicleVectorParam(strVehicleVectorParam vp) |
@@ -3511,6 +3516,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3511 | if (m_vehicle == null) | 3516 | if (m_vehicle == null) |
3512 | return; | 3517 | return; |
3513 | m_vehicle.ProcessVectorVehicleParam((Vehicle)vp.param, vp.value); | 3518 | m_vehicle.ProcessVectorVehicleParam((Vehicle)vp.param, vp.value); |
3519 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3520 | { | ||
3521 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3522 | SafeNativeMethods.BodyEnable(Body); | ||
3523 | } | ||
3514 | } | 3524 | } |
3515 | 3525 | ||
3516 | private void changeVehicleRotationParam(strVehicleQuatParam qp) | 3526 | private void changeVehicleRotationParam(strVehicleQuatParam qp) |
@@ -3518,6 +3528,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3518 | if (m_vehicle == null) | 3528 | if (m_vehicle == null) |
3519 | return; | 3529 | return; |
3520 | m_vehicle.ProcessRotationVehicleParam((Vehicle)qp.param, qp.value); | 3530 | m_vehicle.ProcessRotationVehicleParam((Vehicle)qp.param, qp.value); |
3531 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3532 | { | ||
3533 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3534 | SafeNativeMethods.BodyEnable(Body); | ||
3535 | } | ||
3521 | } | 3536 | } |
3522 | 3537 | ||
3523 | private void changeVehicleFlags(strVehicleBoolParam bp) | 3538 | private void changeVehicleFlags(strVehicleBoolParam bp) |
@@ -3525,48 +3540,93 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3525 | if (m_vehicle == null) | 3540 | if (m_vehicle == null) |
3526 | return; | 3541 | return; |
3527 | m_vehicle.ProcessVehicleFlags(bp.param, bp.value); | 3542 | m_vehicle.ProcessVehicleFlags(bp.param, bp.value); |
3543 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3544 | { | ||
3545 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3546 | SafeNativeMethods.BodyEnable(Body); | ||
3547 | } | ||
3528 | } | 3548 | } |
3529 | 3549 | ||
3530 | private void changeBuoyancy(float b) | 3550 | private void changeBuoyancy(float b) |
3531 | { | 3551 | { |
3532 | m_buoyancy = b; | 3552 | m_buoyancy = b; |
3553 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3554 | { | ||
3555 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3556 | SafeNativeMethods.BodyEnable(Body); | ||
3557 | } | ||
3533 | } | 3558 | } |
3534 | 3559 | ||
3535 | private void changePIDTarget(Vector3 trg) | 3560 | private void changePIDTarget(Vector3 trg) |
3536 | { | 3561 | { |
3537 | m_PIDTarget = trg; | 3562 | m_PIDTarget = trg; |
3563 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3564 | { | ||
3565 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3566 | SafeNativeMethods.BodyEnable(Body); | ||
3567 | } | ||
3538 | } | 3568 | } |
3539 | 3569 | ||
3540 | private void changePIDTau(float tau) | 3570 | private void changePIDTau(float tau) |
3541 | { | 3571 | { |
3542 | m_PIDTau = tau; | 3572 | m_PIDTau = tau; |
3573 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3574 | { | ||
3575 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3576 | SafeNativeMethods.BodyEnable(Body); | ||
3577 | } | ||
3543 | } | 3578 | } |
3544 | 3579 | ||
3545 | private void changePIDActive(bool val) | 3580 | private void changePIDActive(bool val) |
3546 | { | 3581 | { |
3547 | m_usePID = val; | 3582 | m_usePID = val; |
3583 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3584 | { | ||
3585 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3586 | SafeNativeMethods.BodyEnable(Body); | ||
3587 | } | ||
3548 | } | 3588 | } |
3549 | 3589 | ||
3550 | private void changePIDHoverHeight(float val) | 3590 | private void changePIDHoverHeight(float val) |
3551 | { | 3591 | { |
3552 | m_PIDHoverHeight = val; | 3592 | m_PIDHoverHeight = val; |
3553 | if (val == 0) | 3593 | if (val == 0) |
3554 | m_useHoverPID = false; | 3594 | m_useHoverPID = false; |
3595 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3596 | { | ||
3597 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3598 | SafeNativeMethods.BodyEnable(Body); | ||
3599 | } | ||
3555 | } | 3600 | } |
3556 | 3601 | ||
3557 | private void changePIDHoverType(PIDHoverType type) | 3602 | private void changePIDHoverType(PIDHoverType type) |
3558 | { | 3603 | { |
3559 | m_PIDHoverType = type; | 3604 | m_PIDHoverType = type; |
3605 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3606 | { | ||
3607 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3608 | SafeNativeMethods.BodyEnable(Body); | ||
3609 | } | ||
3560 | } | 3610 | } |
3561 | 3611 | ||
3562 | private void changePIDHoverTau(float tau) | 3612 | private void changePIDHoverTau(float tau) |
3563 | { | 3613 | { |
3564 | m_PIDHoverTau = tau; | 3614 | m_PIDHoverTau = tau; |
3615 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3616 | { | ||
3617 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3618 | SafeNativeMethods.BodyEnable(Body); | ||
3619 | } | ||
3565 | } | 3620 | } |
3566 | 3621 | ||
3567 | private void changePIDHoverActive(bool active) | 3622 | private void changePIDHoverActive(bool active) |
3568 | { | 3623 | { |
3569 | m_useHoverPID = active; | 3624 | m_useHoverPID = active; |
3625 | if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) | ||
3626 | { | ||
3627 | SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); | ||
3628 | SafeNativeMethods.BodyEnable(Body); | ||
3629 | } | ||
3570 | } | 3630 | } |
3571 | 3631 | ||
3572 | private void changeInertia(PhysicsInertiaData inertia) | 3632 | private void changeInertia(PhysicsInertiaData inertia) |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 567de23..c231787 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -288,10 +288,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
288 | 288 | ||
289 | public IConfigSource m_config; | 289 | public IConfigSource m_config; |
290 | 290 | ||
291 | public bool physics_logging = false; | ||
292 | public int physics_logging_interval = 0; | ||
293 | public bool physics_logging_append_existing_logfile = false; | ||
294 | |||
295 | public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize); | 291 | public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize); |
296 | 292 | ||
297 | private ODERayCastRequestManager m_rayCastManager; | 293 | private ODERayCastRequestManager m_rayCastManager; |
@@ -469,10 +465,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
469 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity); | 465 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", geomDefaultDensity); |
470 | // bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable); | 466 | // bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", bodyFramesAutoDisable); |
471 | 467 | ||
472 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); | ||
473 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); | ||
474 | physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); | ||
475 | |||
476 | minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", minimumGroundFlightOffset); | 468 | minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", minimumGroundFlightOffset); |
477 | maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", maximumMassObject); | 469 | maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", maximumMassObject); |
478 | 470 | ||
@@ -633,51 +625,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
633 | return; | 625 | return; |
634 | } | 626 | } |
635 | 627 | ||
636 | // get geom bodies to check if we already a joint contact | ||
637 | // guess this shouldn't happen now | ||
638 | IntPtr b1 = SafeNativeMethods.GeomGetBody(g1); | ||
639 | IntPtr b2 = SafeNativeMethods.GeomGetBody(g2); | ||
640 | 628 | ||
641 | // d.GeomClassID id = d.GeomGetClass(g1); | ||
642 | 629 | ||
643 | // Figure out how many contact points we have | 630 | // Figure out how many contact points we have |
644 | int count = 0; | 631 | int count = 0; |
645 | try | 632 | try |
646 | { | 633 | { |
647 | // Colliding Geom To Geom | ||
648 | // This portion of the function 'was' blatantly ripped off from BoxStack.cs | ||
649 | |||
650 | if (g1 == g2) | 634 | if (g1 == g2) |
651 | return; // Can't collide with yourself | 635 | return; // Can't collide with yourself |
652 | 636 | ||
653 | // if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) | ||
654 | // return; | ||
655 | /* | ||
656 | // debug | ||
657 | PhysicsActor dp2; | ||
658 | if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass) | ||
659 | { | ||
660 | d.AABB aabb; | ||
661 | d.GeomGetAABB(g2, out aabb); | ||
662 | float x = aabb.MaxX - aabb.MinX; | ||
663 | float y = aabb.MaxY - aabb.MinY; | ||
664 | float z = aabb.MaxZ - aabb.MinZ; | ||
665 | if (x > 60.0f || y > 60.0f || z > 60.0f) | ||
666 | { | ||
667 | if (!actor_name_map.TryGetValue(g2, out dp2)) | ||
668 | m_log.WarnFormat("[PHYSICS]: failed actor mapping for geom 2"); | ||
669 | else | ||
670 | m_log.WarnFormat("[PHYSICS]: land versus large prim geo {0},size {1}, AABBsize <{2},{3},{4}>, at {5} ori {6},({7})", | ||
671 | dp2.Name, dp2.Size, x, y, z, | ||
672 | dp2.Position.ToString(), | ||
673 | dp2.Orientation.ToString(), | ||
674 | dp2.Orientation.Length()); | ||
675 | return; | ||
676 | } | ||
677 | } | ||
678 | // | ||
679 | */ | ||
680 | |||
681 | if (SafeNativeMethods.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || | 637 | if (SafeNativeMethods.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || |
682 | SafeNativeMethods.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc) | 638 | SafeNativeMethods.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc) |
683 | { | 639 | { |
@@ -707,29 +663,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
707 | if (count == 0) | 663 | if (count == 0) |
708 | return; | 664 | return; |
709 | 665 | ||
666 | // get first contact | ||
667 | SafeNativeMethods.ContactGeom curContact = new SafeNativeMethods.ContactGeom(); | ||
668 | if (!GetCurContactGeom(0, ref curContact)) | ||
669 | return; | ||
670 | |||
710 | // try get physical actors | 671 | // try get physical actors |
711 | PhysicsActor p1; | 672 | PhysicsActor p1; |
712 | PhysicsActor p2; | ||
713 | |||
714 | if (!actor_name_map.TryGetValue(g1, out p1)) | 673 | if (!actor_name_map.TryGetValue(g1, out p1)) |
715 | { | 674 | { |
716 | m_log.WarnFormat("[PHYSICS]: failed actor mapping for geom 1"); | 675 | m_log.WarnFormat("[PHYSICS]: failed actor mapping for geom 1"); |
717 | return; | 676 | return; |
718 | } | 677 | } |
719 | 678 | ||
679 | PhysicsActor p2; | ||
720 | if (!actor_name_map.TryGetValue(g2, out p2)) | 680 | if (!actor_name_map.TryGetValue(g2, out p2)) |
721 | { | 681 | { |
722 | m_log.WarnFormat("[PHYSICS]: failed actor mapping for geom 2"); | 682 | m_log.WarnFormat("[PHYSICS]: failed actor mapping for geom 2"); |
723 | return; | 683 | return; |
724 | } | 684 | } |
725 | 685 | ||
726 | |||
727 | // get first contact | ||
728 | SafeNativeMethods.ContactGeom curContact = new SafeNativeMethods.ContactGeom(); | ||
729 | |||
730 | if (!GetCurContactGeom(0, ref curContact)) | ||
731 | return; | ||
732 | |||
733 | ContactPoint maxDepthContact = new ContactPoint(); | 686 | ContactPoint maxDepthContact = new ContactPoint(); |
734 | 687 | ||
735 | // do volume detection case | 688 | // do volume detection case |
@@ -879,6 +832,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
879 | if(dop1ava || dop2ava) | 832 | if(dop1ava || dop2ava) |
880 | smoothMesh = false; | 833 | smoothMesh = false; |
881 | 834 | ||
835 | IntPtr b1 = SafeNativeMethods.GeomGetBody(g1); | ||
836 | IntPtr b2 = SafeNativeMethods.GeomGetBody(g2); | ||
837 | |||
882 | while (true) | 838 | while (true) |
883 | { | 839 | { |
884 | noskip = true; | 840 | noskip = true; |