* This resolves the null exceptions when a script is manipulating a physical object in ODE and you delete the object. The script is still running and trying to add force, but the object reference is null.
							parent
							
								
									f603e57e9a
								
							
						
					
					
						commit
						c926962862
					
				| 
						 | 
				
			
			@ -580,11 +580,17 @@ namespace OpenSim.Region.Environment.Scenes
 | 
			
		|||
 | 
			
		||||
        public void applyImpulse(PhysicsVector impulse)
 | 
			
		||||
        {
 | 
			
		||||
            // We check if rootpart is null here because scripts don't delete if you delete the host.
 | 
			
		||||
            // This means that unfortunately, we can pass a null physics actor to Simulate!
 | 
			
		||||
            // Make sure we don't do that!
 | 
			
		||||
            SceneObjectPart rootpart = m_rootPart;
 | 
			
		||||
            if (m_rootPart.PhysActor != null)
 | 
			
		||||
            if (rootpart != null)
 | 
			
		||||
            {
 | 
			
		||||
                m_rootPart.PhysActor.AddForce(impulse);
 | 
			
		||||
                m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
 | 
			
		||||
                if (rootpart.PhysActor != null)
 | 
			
		||||
                {
 | 
			
		||||
                    rootpart.PhysActor.AddForce(impulse);
 | 
			
		||||
                    m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -429,6 +429,7 @@ namespace OpenSim.Region.Physics.OdePlugin
 | 
			
		|||
 | 
			
		||||
        public void ProcessTaints(float timestep)
 | 
			
		||||
        {
 | 
			
		||||
            System.Threading.Thread.Sleep(5);
 | 
			
		||||
            if (m_taintposition != _position)
 | 
			
		||||
                Move(timestep);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -712,6 +713,7 @@ namespace OpenSim.Region.Physics.OdePlugin
 | 
			
		|||
 | 
			
		||||
        public void changeAddForce(float timestamp)
 | 
			
		||||
        {
 | 
			
		||||
            System.Threading.Thread.Sleep(2);
 | 
			
		||||
            lock (m_forcelist)
 | 
			
		||||
            {
 | 
			
		||||
                //m_log.Info("[PHYSICS]: dequeing forcelist");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -639,6 +639,7 @@ namespace OpenSim.Region.Physics.OdePlugin
 | 
			
		|||
        {
 | 
			
		||||
            lock (OdeLock)
 | 
			
		||||
            {
 | 
			
		||||
                System.Threading.Thread.Sleep(20);
 | 
			
		||||
                if (prim.IsPhysical)
 | 
			
		||||
                {
 | 
			
		||||
                    prim.disableBody();
 | 
			
		||||
| 
						 | 
				
			
			@ -733,7 +734,7 @@ namespace OpenSim.Region.Physics.OdePlugin
 | 
			
		|||
            // never be called if the prim is physical(active)
 | 
			
		||||
 | 
			
		||||
            // All physical prim end up in the root space
 | 
			
		||||
 | 
			
		||||
            System.Threading.Thread.Sleep(20);
 | 
			
		||||
            if (currentspace != space)
 | 
			
		||||
            {
 | 
			
		||||
                if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr) 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue