minor changes.. a few physicsactor -> pa and a use a constant with |'ed bit fields in place of 6 individual checks ||'ed

avinationmerge
UbitUmarov 2012-04-04 18:24:56 +01:00
parent 867d50d14c
commit 016079ef27
1 changed files with 31 additions and 35 deletions

View File

@ -2153,26 +2153,26 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup.RootPart == this) if (ParentGroup.RootPart == this)
AngularVelocity = new Vector3(0, 0, 0); AngularVelocity = new Vector3(0, 0, 0);
if (PhysActor.Phantom) if (pa.Phantom)
{ {
RemoveFromPhysics(); RemoveFromPhysics();
return; return;
} }
PhysActor.IsPhysical = UsePhysics; pa.IsPhysical = UsePhysics;
PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; pa.OnOutOfBounds -= PhysicsOutOfBounds;
PhysActor.delink(); pa.delink();
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{ {
// destroy all joints connected to this now deactivated body // destroy all joints connected to this now deactivated body
ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor); ParentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa);
} }
} }
} }
if (PhysActor.IsPhysical != UsePhysics) if (pa.IsPhysical != UsePhysics)
PhysActor.IsPhysical = UsePhysics; pa.IsPhysical = UsePhysics;
if (UsePhysics) if (UsePhysics)
{ {
@ -2197,8 +2197,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
bool phan = ((Flags & PrimFlags.Phantom) != 0); bool phan = ((Flags & PrimFlags.Phantom) != 0);
if (PhysActor.Phantom != phan) if (pa.Phantom != phan)
PhysActor.Phantom = phan; pa.Phantom = phan;
// If this part is a sculpt then delay the physics update until we've asynchronously loaded the // If this part is a sculpt then delay the physics update until we've asynchronously loaded the
@ -2320,7 +2320,10 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor pa = PhysActor; PhysicsActor pa = PhysActor;
if (pa != null) if (pa != null)
return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); {
Vector3 vtmp = pa.CenterOfMass;
return vtmp;
}
else else
return new Vector3(0, 0, 0); return new Vector3(0, 0, 0);
} }
@ -3524,18 +3527,12 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor pa = PhysActor; PhysicsActor pa = PhysActor;
if (pa != null) if (pa != null)
pa.FloatOnWater = floatYN == 1; pa.FloatOnWater = (floatYN == 1);
} }
public void SetForce(Vector3 force) public void SetForce(Vector3 force)
{ {
Force = force; Force = force;
/*
if (PhysActor != null)
{
PhysActor.Force = force;
}
*/
} }
public SOPVehicle sopVehicle public SOPVehicle sopVehicle
@ -5066,33 +5063,32 @@ namespace OpenSim.Region.Framework.Scenes
} }
PhysicsActor pa = PhysActor; PhysicsActor pa = PhysActor;
if (pa != null)
{
const scriptEvents NeededSubsEvents = (
scriptEvents.collision | scriptEvents.collision_start| scriptEvents.collision_end |
scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end
);
if ( if (
((AggregateScriptEvents & scriptEvents.collision) != 0) || // ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) || // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) || // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
(CollisionSound != UUID.Zero) ((AggregateScriptEvents & NeededSubsEvents) != 0) || (CollisionSound != UUID.Zero)
) )
{ {
// subscribe to physics updates. // subscribe to physics updates.
if (pa != null)
{
pa.OnCollisionUpdate += PhysicsCollision; pa.OnCollisionUpdate += PhysicsCollision;
pa.SubscribeEvents(1000); pa.SubscribeEvents(1000);
} }
}
else else
{
if (pa != null)
{ {
pa.UnSubscribeEvents(); pa.UnSubscribeEvents();
pa.OnCollisionUpdate -= PhysicsCollision; pa.OnCollisionUpdate -= PhysicsCollision;
} }
} }
//if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0)
//{ //{
// ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;