diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 129db5d..884a5a7 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -163,8 +163,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
163 | const float comumSoftContactERP = 0.1f; | 163 | const float comumSoftContactERP = 0.1f; |
164 | const float comumContactCFM = 0.0001f; | 164 | const float comumContactCFM = 0.0001f; |
165 | 165 | ||
166 | float frictionScale = 1.0f; | ||
167 | |||
168 | float frictionMovementMult = 0.3f; | 166 | float frictionMovementMult = 0.3f; |
169 | 167 | ||
170 | float TerrainBounce = 0.1f; | 168 | float TerrainBounce = 0.1f; |
@@ -450,33 +448,30 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
450 | ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf); | 448 | ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf); |
451 | GlobalContactsArray = GlobalContactsArray = Marshal.AllocHGlobal(maxContactsbeforedeath * d.Contact.unmanagedSizeOf); | 449 | GlobalContactsArray = GlobalContactsArray = Marshal.AllocHGlobal(maxContactsbeforedeath * d.Contact.unmanagedSizeOf); |
452 | 450 | ||
453 | m_materialContactsData[(int)Material.Stone].mu = frictionScale * 0.8f; | 451 | m_materialContactsData[(int)Material.Stone].mu = 0.8f; |
454 | m_materialContactsData[(int)Material.Stone].bounce = 0.4f; | 452 | m_materialContactsData[(int)Material.Stone].bounce = 0.4f; |
455 | 453 | ||
456 | m_materialContactsData[(int)Material.Metal].mu = frictionScale * 0.3f; | 454 | m_materialContactsData[(int)Material.Metal].mu = 0.3f; |
457 | m_materialContactsData[(int)Material.Metal].bounce = 0.4f; | 455 | m_materialContactsData[(int)Material.Metal].bounce = 0.4f; |
458 | 456 | ||
459 | m_materialContactsData[(int)Material.Glass].mu = frictionScale * 0.2f; | 457 | m_materialContactsData[(int)Material.Glass].mu = 0.2f; |
460 | m_materialContactsData[(int)Material.Glass].bounce = 0.7f; | 458 | m_materialContactsData[(int)Material.Glass].bounce = 0.7f; |
461 | 459 | ||
462 | m_materialContactsData[(int)Material.Wood].mu = frictionScale * 0.6f; | 460 | m_materialContactsData[(int)Material.Wood].mu = 0.6f; |
463 | m_materialContactsData[(int)Material.Wood].bounce = 0.5f; | 461 | m_materialContactsData[(int)Material.Wood].bounce = 0.5f; |
464 | 462 | ||
465 | m_materialContactsData[(int)Material.Flesh].mu = frictionScale * 0.9f; | 463 | m_materialContactsData[(int)Material.Flesh].mu = 0.9f; |
466 | m_materialContactsData[(int)Material.Flesh].bounce = 0.3f; | 464 | m_materialContactsData[(int)Material.Flesh].bounce = 0.3f; |
467 | 465 | ||
468 | m_materialContactsData[(int)Material.Plastic].mu = frictionScale * 0.4f; | 466 | m_materialContactsData[(int)Material.Plastic].mu = 0.4f; |
469 | m_materialContactsData[(int)Material.Plastic].bounce = 0.7f; | 467 | m_materialContactsData[(int)Material.Plastic].bounce = 0.7f; |
470 | 468 | ||
471 | m_materialContactsData[(int)Material.Rubber].mu = frictionScale * 0.9f; | 469 | m_materialContactsData[(int)Material.Rubber].mu = 0.9f; |
472 | m_materialContactsData[(int)Material.Rubber].bounce = 0.95f; | 470 | m_materialContactsData[(int)Material.Rubber].bounce = 0.95f; |
473 | 471 | ||
474 | m_materialContactsData[(int)Material.light].mu = 0.0f; | 472 | m_materialContactsData[(int)Material.light].mu = 0.0f; |
475 | m_materialContactsData[(int)Material.light].bounce = 0.0f; | 473 | m_materialContactsData[(int)Material.light].bounce = 0.0f; |
476 | 474 | ||
477 | TerrainFriction *= frictionScale; | ||
478 | // AvatarFriction *= frictionScale; | ||
479 | |||
480 | // Set the gravity,, don't disable things automatically (we set it explicitly on some things) | 475 | // Set the gravity,, don't disable things automatically (we set it explicitly on some things) |
481 | 476 | ||
482 | d.WorldSetGravity(world, gravityx, gravityy, gravityz); | 477 | d.WorldSetGravity(world, gravityx, gravityy, gravityz); |
@@ -562,13 +557,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
562 | } | 557 | } |
563 | 558 | ||
564 | 559 | ||
565 | /// <summary> | ||
566 | /// This is our near callback. A geometry is near a body | ||
567 | /// </summary> | ||
568 | /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param> | ||
569 | /// <param name="g1">a geometry or space</param> | ||
570 | /// <param name="g2">another geometry or space</param> | ||
571 | /// | ||
572 | 560 | ||
573 | private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) | 561 | private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) |
574 | { | 562 | { |
@@ -580,7 +568,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
580 | return true; | 568 | return true; |
581 | } | 569 | } |
582 | 570 | ||
583 | 571 | /// <summary> | |
572 | /// This is our near callback. A geometry is near a body | ||
573 | /// </summary> | ||
574 | /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param> | ||
575 | /// <param name="g1">a geometry or space</param> | ||
576 | /// <param name="g2">another geometry or space</param> | ||
577 | /// | ||
584 | 578 | ||
585 | private void near(IntPtr space, IntPtr g1, IntPtr g2) | 579 | private void near(IntPtr space, IntPtr g1, IntPtr g2) |
586 | { | 580 | { |
@@ -699,8 +693,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
699 | // big messy collision analises | 693 | // big messy collision analises |
700 | float mu = 0; | 694 | float mu = 0; |
701 | float bounce = 0; | 695 | float bounce = 0; |
702 | ContactData contactdata1; | 696 | ContactData contactdata1 = new ContactData(0, 0); |
703 | ContactData contactdata2; | 697 | ContactData contactdata2 = new ContactData(0, 0); |
704 | bool erpSoft = false; | 698 | bool erpSoft = false; |
705 | 699 | ||
706 | String name = null; | 700 | String name = null; |
@@ -714,8 +708,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
714 | switch (p2.PhysicsActorType) | 708 | switch (p2.PhysicsActorType) |
715 | { | 709 | { |
716 | case (int)ActorTypes.Agent: | 710 | case (int)ActorTypes.Agent: |
717 | contactdata1 = p1.ContactData; | 711 | p1.getContactData(ref contactdata1); |
718 | contactdata2 = p2.ContactData; | 712 | p2.getContactData(ref contactdata2); |
713 | |||
719 | bounce = contactdata1.bounce * contactdata2.bounce; | 714 | bounce = contactdata1.bounce * contactdata2.bounce; |
720 | 715 | ||
721 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); | 716 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); |
@@ -727,8 +722,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
727 | p2.CollidingObj = true; | 722 | p2.CollidingObj = true; |
728 | break; | 723 | break; |
729 | case (int)ActorTypes.Prim: | 724 | case (int)ActorTypes.Prim: |
730 | contactdata1 = p1.ContactData; | 725 | p1.getContactData(ref contactdata1); |
731 | contactdata2 = p2.ContactData; | 726 | p2.getContactData(ref contactdata2); |
732 | bounce = contactdata1.bounce * contactdata2.bounce; | 727 | bounce = contactdata1.bounce * contactdata2.bounce; |
733 | 728 | ||
734 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); | 729 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); |
@@ -749,8 +744,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
749 | switch (p2.PhysicsActorType) | 744 | switch (p2.PhysicsActorType) |
750 | { | 745 | { |
751 | case (int)ActorTypes.Agent: | 746 | case (int)ActorTypes.Agent: |
752 | contactdata1 = p1.ContactData; | 747 | p1.getContactData(ref contactdata1); |
753 | contactdata2 = p2.ContactData; | 748 | p2.getContactData(ref contactdata2); |
754 | bounce = contactdata1.bounce * contactdata2.bounce; | 749 | bounce = contactdata1.bounce * contactdata2.bounce; |
755 | 750 | ||
756 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); | 751 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); |
@@ -768,8 +763,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
768 | p1.CollidingObj = true; | 763 | p1.CollidingObj = true; |
769 | p2.CollidingObj = true; | 764 | p2.CollidingObj = true; |
770 | } | 765 | } |
771 | contactdata1 = p1.ContactData; | 766 | p1.getContactData(ref contactdata1); |
772 | contactdata2 = p2.ContactData; | 767 | p2.getContactData(ref contactdata2); |
773 | bounce = contactdata1.bounce * contactdata2.bounce; | 768 | bounce = contactdata1.bounce * contactdata2.bounce; |
774 | erpSoft = true; | 769 | erpSoft = true; |
775 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); | 770 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); |
@@ -784,7 +779,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
784 | if (name == "Terrain") | 779 | if (name == "Terrain") |
785 | { | 780 | { |
786 | erpSoft = true; | 781 | erpSoft = true; |
787 | contactdata1 = p1.ContactData; | 782 | p1.getContactData(ref contactdata1); |
788 | bounce = contactdata1.bounce * TerrainBounce; | 783 | bounce = contactdata1.bounce * TerrainBounce; |
789 | mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); | 784 | mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); |
790 | if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) | 785 | if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) |
@@ -811,7 +806,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
811 | { | 806 | { |
812 | erpSoft = true; | 807 | erpSoft = true; |
813 | p2.CollidingGround = true; | 808 | p2.CollidingGround = true; |
814 | contactdata2 = p2.ContactData; | 809 | p2.getContactData(ref contactdata2); |
815 | bounce = contactdata2.bounce * TerrainBounce; | 810 | bounce = contactdata2.bounce * TerrainBounce; |
816 | mu = (float)Math.Sqrt(contactdata2.mu * TerrainFriction); | 811 | mu = (float)Math.Sqrt(contactdata2.mu * TerrainFriction); |
817 | 812 | ||