--- trunk/NewtonPlugin/NewtonPrim.cs 2009/03/07 16:15:28 12 +++ trunk/NewtonPlugin/NewtonPrim.cs 2009/09/17 21:39:23 17 @@ -31,11 +31,14 @@ using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; +using System.Reflection; +using log4net; namespace OpenSim.Region.Physics.NewtonPlugin { public class NewtonPrim : PhysicsActor { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private float _mass; private PhysicsVector _position; private PhysicsVector _velocity; @@ -136,7 +139,10 @@ public override PhysicsVector Position { get { return _position; } - set { _position = value; } + set { + // m_log.InfoFormat("[NEWTONPRIM] Somebody set our position to {0}", value); + _position = value; + } } public override PhysicsVector Size @@ -148,11 +154,22 @@ public override float Mass { get { return _mass; } + // set { + // m_log.InfoFormat("[NEWTONPRIM] Somebody tried to set mass to {0}, ignored.", + // value); + // } } + // We're the Physics Engine, we control mass!!! + // (More to the point : I don't know how to ask + // for the out-of-engine mass, and it was getting + // set after the object had been enabled physical, + // which led to inconsistencies and scariness + // with AddForce) + public void SetMass(float mass) { - _mass = mass; + // m_log.InfoFormat("[NEWTONPRIM] Somebody tried to set mass to {0}, ignored.",mass); } public override PhysicsVector Force @@ -245,10 +262,12 @@ set { _oldAcceleration = value; } } + // set commented out because PhysicsActor.Acceleration doesn't have + // a set! public override PhysicsVector Acceleration { get { return _acceleration; } - // set { _acceleration = value; } + // set { _acceleration = value; } } public PhysicsVector Jerk @@ -332,6 +351,14 @@ public override void AddForce(PhysicsVector force, bool pushforce) { + // I don't understand what pushforce is, so I'm going to + // ignore it for now...! (rknop 2009/09/14) + + // m_log.InfoFormat("[NEWTONPRIM] Adding force {0} to prim at {1} with mass {2}", + // force, _position, _mass); + _velocity += force/_mass; + // m_log.InfoFormat("[NEWTONPRIM] When done : position = {0}, velocity={1}, acceleration={2}, jerk={3}", + // _position, _velocity, _acceleration, _jerk); } public override void AddAngularForce(PhysicsVector force, bool pushforce)