Add rotationalVelocity and acceleration to variables that are synced in PhysicsActor. Remove unused Prop class.
parent
8d87d9e42d
commit
270f7e653a
|
@ -390,6 +390,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
pa.Position = data["position"].AsVector3();
|
||||
pa.Force = data["force"].AsVector3();
|
||||
pa.Velocity = data["velocity"].AsVector3();
|
||||
pa.RotationalVelocity = data["rotationalVelocity"].AsVector3();
|
||||
pa.Acceleration = data["acceleration"].AsVector3();
|
||||
pa.Torque = data["torque"].AsVector3();
|
||||
pa.Orientation = data["orientantion"].AsQuaternion();
|
||||
pa.IsPhysical = data["isPhysical"].AsBoolean(); // receive??
|
||||
|
@ -444,6 +446,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
data["position"] = OSD.FromVector3(pa.Position);
|
||||
data["force"] = OSD.FromVector3(pa.Force);
|
||||
data["velocity"] = OSD.FromVector3(pa.Velocity);
|
||||
data["rotationalVelocity"] = OSD.FromVector3(pa.RotationalVelocity);
|
||||
data["acceleration"] = OSD.FromVector3(pa.Acceleration);
|
||||
data["torque"] = OSD.FromVector3(pa.Torque);
|
||||
data["orientation"] = OSD.FromQuaternion(pa.Orientation);
|
||||
data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical);
|
||||
|
|
|
@ -350,6 +350,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
pa.Position = data["position"].AsVector3();
|
||||
pa.Force = data["force"].AsVector3();
|
||||
pa.Velocity = data["velocity"].AsVector3();
|
||||
pa.RotationalVelocity = data["rotationalVelocity"].AsVector3();
|
||||
pa.Acceleration = data["acceleration"].AsVector3();
|
||||
pa.Torque = data["torque"].AsVector3();
|
||||
pa.Orientation = data["orientantion"].AsQuaternion();
|
||||
pa.IsPhysical = data["isPhysical"].AsBoolean(); // receive??
|
||||
|
@ -402,6 +404,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
data["position"] = OSD.FromVector3(pa.Position);
|
||||
data["force"] = OSD.FromVector3(pa.Force);
|
||||
data["velocity"] = OSD.FromVector3(pa.Velocity);
|
||||
data["rotationalVelocity"] = OSD.FromVector3(pa.RotationalVelocity);
|
||||
data["acceleration"] = OSD.FromVector3(pa.Acceleration);
|
||||
data["torque"] = OSD.FromVector3(pa.Torque);
|
||||
data["orientation"] = OSD.FromQuaternion(pa.Orientation);
|
||||
data["isPhysical"] = OSD.FromBoolean(pa.IsPhysical);
|
||||
|
|
|
@ -273,7 +273,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
public void SendUpdate(PhysicsActor pa)
|
||||
{
|
||||
// m_log.DebugFormat("{0}: SendUpdate for {1}", LogHeader, pa.LocalID);
|
||||
this.m_sceneToPhysEngineConnector.SendPhysUpdateAttributes(pa);
|
||||
if (m_sceneToPhysEngineConnector != null)
|
||||
{
|
||||
this.m_sceneToPhysEngineConnector.SendPhysUpdateAttributes(pa);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -127,6 +127,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public Vector3 position;
|
||||
public Vector3 force;
|
||||
public Vector3 velocity;
|
||||
public Vector3 rotationalVelocity;
|
||||
public Vector3 torque;
|
||||
public Quaternion orientation;
|
||||
public Boolean isPhysical;
|
||||
|
@ -140,6 +141,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
if (!AlmostEqual(position, pa.Position)) { position = pa.Position; ret = true; }
|
||||
if (!AlmostEqual(force, pa.Force)) { force = pa.Force; ret = true; }
|
||||
if (!AlmostEqual(velocity, pa.Velocity)) { velocity = pa.Velocity; ret = true; }
|
||||
if (!AlmostEqual(rotationalVelocity, pa.RotationalVelocity)) { rotationalVelocity = pa.RotationalVelocity; ret = true; }
|
||||
if (!AlmostEqual(torque, pa.Torque)) { torque = pa.Torque; ret = true; }
|
||||
if (orientation != pa.Orientation) { orientation = pa.Orientation; ret = true; }
|
||||
if (isPhysical != pa.IsPhysical) { isPhysical = pa.IsPhysical; ret = true; }
|
||||
|
@ -149,9 +151,9 @@ namespace OpenSim.Region.Physics.Manager
|
|||
}
|
||||
private bool AlmostEqual(Vector3 a, Vector3 b)
|
||||
{
|
||||
if (Math.Abs(a.X - b.X) > 0.001) return false;
|
||||
if (Math.Abs(a.Y - b.Y) > 0.001) return false;
|
||||
if (Math.Abs(a.Z - b.Z) > 0.001) return false;
|
||||
if (Math.Abs(a.X - b.X) > 0.01) return false;
|
||||
if (Math.Abs(a.Y - b.Y) > 0.01) return false;
|
||||
if (Math.Abs(a.Z - b.Z) > 0.01) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +275,12 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public abstract Vector3 Velocity { get; set; }
|
||||
public abstract Vector3 Torque { get; set; }
|
||||
public abstract float CollisionScore { get; set;}
|
||||
public abstract Vector3 Acceleration { get; }
|
||||
// RA: used to be abstract but made virtual so 'set' does not need to be added to all phys engines
|
||||
private Vector3 _acceleration;
|
||||
public virtual Vector3 Acceleration {
|
||||
get { return _acceleration; }
|
||||
set { _acceleration = value; }
|
||||
}
|
||||
public abstract Quaternion Orientation { get; set; }
|
||||
public abstract int PhysicsActorType { get; set; }
|
||||
public abstract bool IsPhysical { get; set; }
|
||||
|
@ -471,6 +478,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return Vector3.Zero; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public override bool IsPhysical
|
||||
|
|
|
@ -835,6 +835,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
set { _acceleration = value; }
|
||||
}
|
||||
|
||||
public void SetAcceleration(Vector3 accel)
|
||||
|
|
|
@ -2501,6 +2501,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
set { _acceleration = value; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,10 @@ public class PECharacter : PhysicsActor
|
|||
private bool _grabbed;
|
||||
private bool _selected;
|
||||
private Vector3 _position;
|
||||
private float _mass;
|
||||
private float _mass = 80f;
|
||||
public float _density = 60f;
|
||||
public float CAPSULE_RADIUS = 0.37f;
|
||||
public float CAPSULE_LENGTH = 2.140599f;
|
||||
private Vector3 _force;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 _torque;
|
||||
|
@ -79,6 +82,7 @@ public class PECharacter : PhysicsActor
|
|||
{
|
||||
_position = pos;
|
||||
_size = size;
|
||||
_density = density;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -88,30 +92,25 @@ public class PECharacter : PhysicsActor
|
|||
public override Vector3 Size {
|
||||
get { return _size; }
|
||||
set { _size = value;
|
||||
Prop.Set(_localID, PropType.Size, _size);
|
||||
}
|
||||
}
|
||||
public override PrimitiveBaseShape Shape {
|
||||
set { _pbs = value;
|
||||
Prop.Set(_localID, PropType.Shape, _pbs);
|
||||
}
|
||||
}
|
||||
public override uint LocalID {
|
||||
set { _localID = value;
|
||||
Prop.Set(_localID, PropType.LocalID, _localID);
|
||||
}
|
||||
get { return _localID; }
|
||||
}
|
||||
public override bool Grabbed {
|
||||
set { _grabbed = value;
|
||||
m_log.Debug("[RPE] PEChar set Grabbed");
|
||||
Prop.Set(_localID, PropType.Grabbed, _grabbed);
|
||||
}
|
||||
}
|
||||
public override bool Selected {
|
||||
set { _selected = value;
|
||||
m_log.Debug("[RPE] PEChar set Selected");
|
||||
Prop.Set(_localID, PropType.Selected, _selected);
|
||||
}
|
||||
}
|
||||
public override void CrossingFailure() { return; }
|
||||
|
@ -122,16 +121,18 @@ public class PECharacter : PhysicsActor
|
|||
public override Vector3 Position {
|
||||
get { return _position; }
|
||||
set { _position = value;
|
||||
Prop.Set(_localID, PropType.Position, _position);
|
||||
}
|
||||
}
|
||||
public override float Mass {
|
||||
get { return _mass; }
|
||||
get {
|
||||
float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH);
|
||||
_mass = _density*AVvolume;
|
||||
return _mass;
|
||||
}
|
||||
}
|
||||
public override Vector3 Force {
|
||||
get { return _force; }
|
||||
set { _force = value;
|
||||
Prop.Set(_localID, PropType.Force, _force);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,19 +153,16 @@ public class PECharacter : PhysicsActor
|
|||
public override Vector3 Velocity {
|
||||
get { return _velocity; }
|
||||
set { _velocity = value;
|
||||
Prop.Set(_localID, PropType.Velocity, _velocity);
|
||||
}
|
||||
}
|
||||
public override Vector3 Torque {
|
||||
get { return _torque; }
|
||||
set { _torque = value;
|
||||
Prop.Set(_localID, PropType.Torque, _torque);
|
||||
}
|
||||
}
|
||||
public override float CollisionScore {
|
||||
get { return _collisionScore; }
|
||||
set { _collisionScore = value;
|
||||
Prop.Set(_localID, PropType.CollisionScore, _collisionScore);
|
||||
}
|
||||
}
|
||||
public override Vector3 Acceleration {
|
||||
|
@ -173,7 +171,6 @@ public class PECharacter : PhysicsActor
|
|||
public override Quaternion Orientation {
|
||||
get { return _orientation; }
|
||||
set { _orientation = value;
|
||||
Prop.Set(_localID, PropType.Orientation, _orientation);
|
||||
}
|
||||
}
|
||||
public override int PhysicsActorType {
|
||||
|
@ -261,6 +258,18 @@ public class PECharacter : PhysicsActor
|
|||
public override float APIDDamping { set { return; } }
|
||||
|
||||
public override void AddForce(Vector3 force, bool pushforce) {
|
||||
if (force.IsFinite())
|
||||
{
|
||||
// base.ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
_velocity.X += force.X;
|
||||
_velocity.Y += force.Y;
|
||||
_velocity.Z += force.Z;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[PHYSICS]: Got a NaN force applied to a Character");
|
||||
}
|
||||
//m_lastUpdateSent = false;
|
||||
}
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce) {
|
||||
}
|
||||
|
|
|
@ -92,34 +92,29 @@ public sealed class PEPrim : PhysicsActor
|
|||
set { _size = value;
|
||||
// m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Size");
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
Prop.Set(_localID, PropType.Size, _size);
|
||||
}
|
||||
}
|
||||
public override PrimitiveBaseShape Shape {
|
||||
set { _pbs = value;
|
||||
m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Shape");
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
Prop.Set(_localID, PropType.Shape, _pbs);
|
||||
}
|
||||
}
|
||||
public override uint LocalID {
|
||||
set { _localID = value;
|
||||
// m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set LocalID");
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
Prop.Set(_localID, PropType.LocalID, _localID);
|
||||
}
|
||||
get { return _localID; }
|
||||
}
|
||||
public override bool Grabbed {
|
||||
set { _grabbed = value;
|
||||
m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Grabbed");
|
||||
Prop.Set(_localID, PropType.Grabbed, _grabbed);
|
||||
}
|
||||
}
|
||||
public override bool Selected {
|
||||
set { _selected = value;
|
||||
m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Selected");
|
||||
Prop.Set(_localID, PropType.Selected, _selected);
|
||||
}
|
||||
}
|
||||
public override void CrossingFailure() { return; }
|
||||
|
@ -132,7 +127,6 @@ public sealed class PEPrim : PhysicsActor
|
|||
set { _position = value;
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
// m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Position");
|
||||
Prop.Set(_localID, PropType.Position, _position);
|
||||
}
|
||||
}
|
||||
public override float Mass {
|
||||
|
@ -143,7 +137,6 @@ public sealed class PEPrim : PhysicsActor
|
|||
set { _force = value;
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
// m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Force");
|
||||
Prop.Set(_localID, PropType.Force, _force);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,21 +158,18 @@ public sealed class PEPrim : PhysicsActor
|
|||
get { return _velocity; }
|
||||
set { _velocity = value;
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
Prop.Set(_localID, PropType.Velocity, _velocity);
|
||||
}
|
||||
}
|
||||
public override Vector3 Torque {
|
||||
get { return _torque; }
|
||||
set { _torque = value;
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
Prop.Set(_localID, PropType.Torque, _torque);
|
||||
}
|
||||
}
|
||||
public override float CollisionScore {
|
||||
get { return _collisionScore; }
|
||||
set { _collisionScore = value;
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
Prop.Set(_localID, PropType.CollisionScore, _collisionScore);
|
||||
}
|
||||
}
|
||||
public override Vector3 Acceleration {
|
||||
|
@ -189,7 +179,6 @@ public sealed class PEPrim : PhysicsActor
|
|||
get { return _orientation; }
|
||||
set { _orientation = value;
|
||||
ChangingActorID = RegionSyncServerModule.ActorID;
|
||||
Prop.Set(_localID, PropType.Orientation, _orientation);
|
||||
}
|
||||
}
|
||||
public override int PhysicsActorType {
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
|
||||
namespace OpenSim.Region.Physics.PEPlugin
|
||||
{
|
||||
public enum PropType
|
||||
{
|
||||
Size,
|
||||
Shape,
|
||||
LocalID,
|
||||
Grabbed,
|
||||
Selected,
|
||||
Position,
|
||||
Force,
|
||||
Velocity,
|
||||
Torque,
|
||||
CollisionScore,
|
||||
Orientation
|
||||
};
|
||||
|
||||
public class Prop
|
||||
{
|
||||
public static void Set(uint localID, PropType type, uint val)
|
||||
{
|
||||
}
|
||||
public static void Set(uint localID, PropType type, Vector3 val)
|
||||
{
|
||||
}
|
||||
public static void Set(uint localID, PropType type, PrimitiveBaseShape val)
|
||||
{
|
||||
}
|
||||
public static void Set(uint localID, PropType type, bool val)
|
||||
{
|
||||
}
|
||||
public static void Set(uint localID, PropType type, float val)
|
||||
{
|
||||
}
|
||||
public static void Set(uint localID, PropType type, Quaternion val)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue