aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs131
1 files changed, 52 insertions, 79 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 72ac605..1d9fa93 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -521,7 +521,7 @@ namespace OpenSim.Region.Physics.OdePlugin
521 d.WorldSetAngularDamping(world, 0.001f); 521 d.WorldSetAngularDamping(world, 0.001f);
522 d.WorldSetAngularDampingThreshold(world, 0f); 522 d.WorldSetAngularDampingThreshold(world, 0f);
523 d.WorldSetLinearDampingThreshold(world, 0f); 523 d.WorldSetLinearDampingThreshold(world, 0f);
524 d.WorldSetMaxAngularSpeed(world, 256f); 524 d.WorldSetMaxAngularSpeed(world, 100f);
525 525
526 d.WorldSetCFM(world,1e-6f); // a bit harder than default 526 d.WorldSetCFM(world,1e-6f); // a bit harder than default
527 //d.WorldSetCFM(world, 1e-4f); // a bit harder than default 527 //d.WorldSetCFM(world, 1e-4f); // a bit harder than default
@@ -1685,17 +1685,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1685 /// <returns></returns> 1685 /// <returns></returns>
1686 public override float Simulate(float timeStep) 1686 public override float Simulate(float timeStep)
1687 { 1687 {
1688 int statstart;
1689 int statchanges = 0;
1690 int statchmove = 0;
1691 int statactmove = 0;
1692 int statray = 0;
1693 int statcol = 0;
1694 int statstep = 0;
1695 int statmovchar = 0;
1696 int statmovprim;
1697 int totjcontact = 0;
1698
1699 // acumulate time so we can reduce error 1688 // acumulate time so we can reduce error
1700 step_time += timeStep; 1689 step_time += timeStep;
1701 1690
@@ -1738,8 +1727,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1738 { 1727 {
1739 try 1728 try
1740 { 1729 {
1741 statstart = Util.EnvironmentTickCount();
1742
1743 // clear pointer/counter to contacts to pass into joints 1730 // clear pointer/counter to contacts to pass into joints
1744 m_global_contactcount = 0; 1731 m_global_contactcount = 0;
1745 1732
@@ -1778,17 +1765,39 @@ namespace OpenSim.Region.Physics.OdePlugin
1778 1765
1779 } 1766 }
1780 1767
1781 statchanges += Util.EnvironmentTickCountSubtract(statstart); 1768 // Move characters
1769 lock (_characters)
1770 {
1771 List<OdeCharacter> defects = new List<OdeCharacter>();
1772 foreach (OdeCharacter actor in _characters)
1773 {
1774 if (actor != null)
1775 actor.Move(ODE_STEPSIZE, defects);
1776 }
1777 if (defects.Count != 0)
1778 {
1779 foreach (OdeCharacter defect in defects)
1780 {
1781 RemoveCharacter(defect);
1782 }
1783 }
1784 }
1785
1786 // Move other active objects
1787 lock (_activegroups)
1788 {
1789 foreach (OdePrim aprim in _activegroups)
1790 {
1791 aprim.Move();
1792 }
1793 }
1782 1794
1783 statactmove += Util.EnvironmentTickCountSubtract(statstart);
1784 //if ((framecount % m_randomizeWater) == 0) 1795 //if ((framecount % m_randomizeWater) == 0)
1785 // randomizeWater(waterlevel); 1796 // randomizeWater(waterlevel);
1786 1797
1787 m_rayCastManager.ProcessQueuedRequests(); 1798 m_rayCastManager.ProcessQueuedRequests();
1788 1799
1789 statray += Util.EnvironmentTickCountSubtract(statstart);
1790 collision_optimized(); 1800 collision_optimized();
1791 statcol += Util.EnvironmentTickCountSubtract(statstart);
1792 1801
1793 lock (_collisionEventPrim) 1802 lock (_collisionEventPrim)
1794 { 1803 {
@@ -1813,38 +1822,39 @@ namespace OpenSim.Region.Physics.OdePlugin
1813 } 1822 }
1814 } 1823 }
1815 1824
1825 // do a ode simulation step
1816 d.WorldQuickStep(world, ODE_STEPSIZE); 1826 d.WorldQuickStep(world, ODE_STEPSIZE);
1817 statstep += Util.EnvironmentTickCountSubtract(statstart); 1827 d.JointGroupEmpty(contactgroup);
1828
1829 // update managed ideia of physical data and do updates to core
1830 /*
1831 lock (_characters)
1832 {
1833 foreach (OdeCharacter actor in _characters)
1834 {
1835 if (actor != null)
1836 {
1837 if (actor.bad)
1838 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
1839
1840 actor.UpdatePositionAndVelocity();
1841 }
1842 }
1843 }
1844 */
1818 1845
1819 // Move characters 1846 lock (_activegroups)
1820 lock (_characters)
1821 { 1847 {
1822 List<OdeCharacter> defects = new List<OdeCharacter>();
1823 foreach (OdeCharacter actor in _characters)
1824 {
1825 if (actor != null)
1826 actor.Move(ODE_STEPSIZE, defects);
1827 }
1828 if (defects.Count != 0)
1829 { 1848 {
1830 foreach (OdeCharacter defect in defects) 1849 foreach (OdePrim actor in _activegroups)
1831 { 1850 {
1832 RemoveCharacter(defect); 1851 if (actor.IsPhysical)
1852 {
1853 actor.UpdatePositionAndVelocity();
1854 }
1833 } 1855 }
1834 } 1856 }
1835 } 1857 }
1836 statchmove += Util.EnvironmentTickCountSubtract(statstart);
1837
1838 // Move other active objects
1839 lock (_activegroups)
1840 {
1841 foreach (OdePrim aprim in _activegroups)
1842 {
1843 aprim.Move();
1844 }
1845 }
1846
1847 //ode.dunlock(world);
1848 } 1858 }
1849 catch (Exception e) 1859 catch (Exception e)
1850 { 1860 {
@@ -1852,32 +1862,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1852// ode.dunlock(world); 1862// ode.dunlock(world);
1853 } 1863 }
1854 1864
1855 d.JointGroupEmpty(contactgroup);
1856 totjcontact += m_global_contactcount;
1857 1865
1858 step_time -= ODE_STEPSIZE; 1866 step_time -= ODE_STEPSIZE;
1859 nodeframes++; 1867 nodeframes++;
1860 } 1868 }
1861 1869
1862 statstart = Util.EnvironmentTickCount();
1863
1864/*
1865// now included in characters move() and done at ode rate
1866// maybe be needed later if we need to do any extra work at hearbeat rate
1867 lock (_characters)
1868 {
1869 foreach (OdeCharacter actor in _characters)
1870 {
1871 if (actor != null)
1872 {
1873 if (actor.bad)
1874 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
1875
1876 actor.UpdatePositionAndVelocity();
1877 }
1878 }
1879 }
1880*/
1881 lock (_badCharacter) 1870 lock (_badCharacter)
1882 { 1871 {
1883 if (_badCharacter.Count > 0) 1872 if (_badCharacter.Count > 0)
@@ -1890,22 +1879,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1890 _badCharacter.Clear(); 1879 _badCharacter.Clear();
1891 } 1880 }
1892 } 1881 }
1893 statmovchar = Util.EnvironmentTickCountSubtract(statstart);
1894
1895 lock (_activegroups)
1896 {
1897 {
1898 foreach (OdePrim actor in _activegroups)
1899 {
1900 if (actor.IsPhysical)
1901 {
1902 actor.UpdatePositionAndVelocity((float)nodeframes * ODE_STEPSIZE);
1903 }
1904 }
1905 }
1906 }
1907
1908 statmovprim = Util.EnvironmentTickCountSubtract(statstart);
1909 1882
1910 int nactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); 1883 int nactivegeoms = d.SpaceGetNumGeoms(ActiveSpace);
1911 int nstaticgeoms = d.SpaceGetNumGeoms(StaticSpace); 1884 int nstaticgeoms = d.SpaceGetNumGeoms(StaticSpace);