Merge commit '20da04fd0c909a00c0cdc2585f242e95c868801a' into bigmerge

avinationmerge
Melanie 2011-10-25 01:43:05 +01:00
commit 747786aac0
3 changed files with 39 additions and 8 deletions

View File

@ -4812,6 +4812,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
position = presence.OffsetPosition; position = presence.OffsetPosition;
velocity = presence.Velocity; velocity = presence.Velocity;
acceleration = Vector3.Zero; acceleration = Vector3.Zero;
// Interestingly, sending this to non-zero will cause the client's avatar to start moving & accelerating
// in that direction, even though we don't model this on the server. Implementing this in the future
// may improve movement smoothness.
// acceleration = new Vector3(1, 0, 0);
angularVelocity = Vector3.Zero; angularVelocity = Vector3.Zero;
rotation = presence.Rotation; rotation = presence.Rotation;

View File

@ -202,10 +202,18 @@ namespace OpenSim.Region.Physics.Manager
public virtual void SetMaterial (int material) public virtual void SetMaterial (int material)
{ {
} }
/// <summary>
/// Position of this actor.
/// </summary>
/// <remarks>
/// Setting this directly moves the actor to a given position.
/// Getting this retrieves the position calculated by physics scene updates, using factors such as velocity and
/// collisions.
/// </remarks>
public abstract Vector3 Position { get; set; } public abstract Vector3 Position { get; set; }
public abstract float Mass { get; } public abstract float Mass { get; }
public abstract Vector3 Force { get; set; } public abstract Vector3 Force { get; set; }
@ -215,11 +223,24 @@ namespace OpenSim.Region.Physics.Manager
public abstract void VehicleRotationParam(int param, Quaternion rotation); public abstract void VehicleRotationParam(int param, Quaternion rotation);
public abstract void VehicleFlags(int param, bool remove); public abstract void VehicleFlags(int param, bool remove);
public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more /// <summary>
/// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
/// </summary>
public abstract void SetVolumeDetect(int param);
public abstract Vector3 GeometricCenter { get; } public abstract Vector3 GeometricCenter { get; }
public abstract Vector3 CenterOfMass { get; } public abstract Vector3 CenterOfMass { get; }
/// <summary>
/// Velocity of this actor.
/// </summary>
/// <remarks>
/// Setting this provides a target velocity for physics scene updates.
/// Getting this returns the velocity calculated by physics scene updates, using factors such as target velocity,
/// time to accelerate and collisions.
/// </remarks>
public abstract Vector3 Velocity { get; set; } public abstract Vector3 Velocity { get; set; }
public abstract Vector3 Torque { get; set; } public abstract Vector3 Torque { get; set; }
public abstract float CollisionScore { get; set;} public abstract float CollisionScore { get; set;}
public abstract Vector3 Acceleration { get; } public abstract Vector3 Acceleration { get; }

View File

@ -886,7 +886,6 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodyAddForce(Body, force.X, force.Y, force.Z); d.BodyAddForce(Body, force.X, force.Y, force.Z);
//d.BodySetRotation(Body, ref m_StandUpRotation); //d.BodySetRotation(Body, ref m_StandUpRotation);
//standupStraight(); //standupStraight();
} }
} }
@ -901,7 +900,8 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param name="timeStep"></param> /// <param name="timeStep"></param>
/// <param name="defects"> /// <param name="defects">
/// If there is something wrong with the character (e.g. its position is non-finite) /// If there is something wrong with the character (e.g. its position is non-finite)
/// then it is added to this list. The ODE structures associated with it are also destroyed.</param> /// then it is added to this list. The ODE structures associated with it are also destroyed.
/// </param>
public void Move(float timeStep, List<OdeCharacter> defects) public void Move(float timeStep, List<OdeCharacter> defects)
{ {
// no lock; for now it's only called from within Simulate() // no lock; for now it's only called from within Simulate()
@ -966,7 +966,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.Vector3 pos = d.BodyGetPosition(Body); d.Vector3 pos = d.BodyGetPosition(Body);
vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2);
vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2); vec.Y = (_target_velocity.Y - vel.Y) * (PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2);
if (flying) if (flying)
{ {
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P;
@ -995,6 +995,10 @@ namespace OpenSim.Region.Physics.OdePlugin
// we're in mid air suspended // we're in mid air suspended
vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D / 6); vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D / 6);
vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D / 6); vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D / 6);
// m_log.DebugFormat(
// "[ODE CHARACTER]: !m_iscolliding && flying, vec {0}, _target_velocity {1}, movementdivisor {2}, vel {3}",
// vec, _target_velocity, movementdivisor, vel);
} }
if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) if (m_iscolliding && !flying && _target_velocity.Z > 0.0f)
@ -1020,11 +1024,11 @@ namespace OpenSim.Region.Physics.OdePlugin
// d.Vector3 pos = d.BodyGetPosition(Body); // d.Vector3 pos = d.BodyGetPosition(Body);
if (_target_velocity.X > 0) if (_target_velocity.X > 0)
{ {
vec.X = ((_target_velocity.X - vel.X)/1.2f)*PID_D; vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
} }
if (_target_velocity.Y > 0) if (_target_velocity.Y > 0)
{ {
vec.Y = ((_target_velocity.Y - vel.Y)/1.2f)*PID_D; vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
} }
} }
@ -1167,7 +1171,7 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <summary> /// <summary>
/// Used internally to destroy the ODE structures associated with this character. /// Used internally to destroy the ODE structures associated with this character.
/// </summary> /// </summary>
public void DestroyOdeStructures() private void DestroyOdeStructures()
{ {
// destroy avatar capsule and related ODE data // destroy avatar capsule and related ODE data
if (Amotor != IntPtr.Zero) if (Amotor != IntPtr.Zero)