several cosmetic on physics

This commit is contained in:
UbitUmarov
2022-11-08 03:56:11 +00:00
parent 87cf092666
commit c060ce1c9c
9 changed files with 45 additions and 89 deletions

View File

@@ -76,11 +76,6 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics
set { return; }
}
public override bool FloatOnWater
{
set { return; }
}
public override bool IsPhysical
{
get { return false; }

View File

@@ -85,11 +85,6 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics
set { return; }
}
public override bool FloatOnWater
{
set { return; }
}
public override bool IsPhysical
{
get { return false; }

View File

@@ -272,11 +272,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
set { m_buoyancy = value; }
}
public override bool FloatOnWater
{
set { return; }
}
public override bool IsPhysical
{
get { return m_isPhysical; }

View File

@@ -88,11 +88,6 @@ namespace OpenSim.Region.PhysicsModule.POS
set { return; }
}
public override bool FloatOnWater
{
set { return; }
}
public override bool IsPhysical
{
get { return false; }

View File

@@ -167,11 +167,6 @@ namespace OpenSim.Region.PhysicsModule.POS
set { return; }
}
public override bool FloatOnWater
{
set { return; }
}
public override Vector3 Velocity
{
get { return _velocity; }

View File

@@ -164,6 +164,9 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
}
}
public abstract class PhysicsActor
{
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -190,6 +193,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public event OutOfBounds OnOutOfBounds;
#pragma warning restore 67
public CameraData TryGetCameraData()
{
GetCameraData handler = OnPhysicsRequestingCameraData;
@@ -209,7 +213,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
cdata.bounce = 0;
}
public AABB2D _AABB2D;
public abstract bool Stopped { get; }
@@ -412,7 +415,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public abstract bool IsColliding { get; set; }
public abstract bool CollidingGround { get; set; }
public abstract bool CollidingObj { get; set; }
public abstract bool FloatOnWater { set; }
public virtual bool FloatOnWater { set { return; } }
public abstract Vector3 RotationalVelocity { get; set; }
public abstract bool Kinematic { get; set; }
public abstract float Buoyancy { get; set; }
@@ -519,11 +522,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
set { return; }
}
public override bool FloatOnWater
{
set { return; }
}
public override bool CollidingGround
{
get { return false; }

View File

@@ -72,47 +72,56 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal AABB2D _AABB2D;
internal Vector3 _position;
private Vector3 _zeroPosition;
private Vector3 _velocity;
private Vector3 _acceleration;
private Vector3 m_rotationalVelocity;
private Vector3 m_size;
private Vector3 m_lastFallVel;
internal Quaternion m_orientation;
public int Colliderfilter = 0;
public float CapsuleSizeZ;
public float CapsuleRadius;
internal Vector2 Orientation2D;
internal float AvaSizeXsq = 0.3f;
internal float AvaSizeYsq = 0.2f;
internal float feetOff = 0;
internal float boneOff = 0;
public IntPtr Body = IntPtr.Zero;
public int m_bodydisablecontrol = 0;
private float m_scenegravityForceZ;
int m_colliderObjectfilter = 0;
int m_colliderGroundfilter = 0;
private SafeNativeMethods.Quaternion m_NativeOrientation2D;
private Vector3 _zeroPosition;
internal Quaternion m_orientation;
private Vector3 _velocity;
private Vector3 m_rotationalVelocity;
private Vector3 _acceleration;
private Vector3 m_lastFallVel;
private Vector3 m_size;
private float m_mass = 80f;
private float m_massInvTimeScaled = 1600f;
private float m_massInvTimeScaled = 1600f;
public readonly float m_density = 60f;
private bool m_pidControllerActive = true;
internal Vector3 CollideNormal;
public float CapsuleRadius;
public float CapsuleSizeZ;
public int _charsListIndex;
public int m_bodydisablecontrol = 0;
const float basePID_D = 0.55f; // scaled for unit mass unit time (2200 /(50*80))
const float basePID_P = 0.225f; // scaled for unit mass unit time (900 /(50*80))
public float PID_D;
public float PID_P;
private readonly ODEScene m_parent_scene;
private readonly float m_sceneGravityZ;
private float m_scenegravityForceZ;
private readonly float m_sceneTimeStep;
private readonly float m_sceneInverseTimeStep;
internal float feetOff = 0;
internal float boneOff = 0;
internal float AvaSizeXsq = 0.3f;
internal float AvaSizeYsq = 0.2f;
public readonly float m_walkMultiplier = 1.0f / 1.3f;
public readonly float m_runMultiplier = 1.0f / 0.8f;
private bool m_flying = false;
@@ -132,9 +141,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// private string m_name = String.Empty;
// other filter control
public int Colliderfilter = 0;
int m_colliderGroundfilter = 0;
int m_colliderObjectfilter = 0;
// Default we're a Character
private const CollisionCategories m_collisionCategories = (CollisionCategories.Character);
@@ -145,7 +151,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
| CollisionCategories.VolumeDtc
);
// we do land collisions not ode | CollisionCategories.Land);
public IntPtr Body = IntPtr.Zero;
//private IntPtr capsule = IntPtr.Zero;
public IntPtr collider = IntPtr.Zero;
@@ -174,7 +179,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_baseLocalID = localID;
m_parent_scene = parent_scene;
m_sceneGravityZ = parent_scene.gravityz;
m_sceneTimeStep = parent_scene.ODE_STEPSIZE;
m_sceneInverseTimeStep = 1.0f / m_sceneTimeStep;
@@ -232,7 +236,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
PID_D = basePID_D * m_massInvTimeScaled;
PID_P = basePID_P * m_massInvTimeScaled;
m_scenegravityForceZ = m_sceneGravityZ * m_mass;
m_scenegravityForceZ = parent_scene.gravityz * m_mass;
m_isPhysical = false; // current status: no ODE information exists
@@ -330,15 +334,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
public override bool FloatOnWater
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set
{
return;
}
}
public override bool IsPhysical
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -920,7 +915,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_massInvTimeScaled = m_mass * m_sceneInverseTimeStep;
PID_D = basePID_D * m_massInvTimeScaled;
PID_P = basePID_P * m_massInvTimeScaled;
m_scenegravityForceZ = m_sceneGravityZ * m_mass;
m_scenegravityForceZ = m_parent_scene.gravityz * m_mass;
Body = SafeNativeMethods.BodyCreate(m_parent_scene.world);
@@ -1270,19 +1265,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_haveLastFallVel = true;
}
Vector3 n = m_parent_scene.GetTerrainNormalAtXY(tmpX, tmpY);
float pidp50 = PID_P * 50;
float depth = terrainheight - aabbminz;
vec.Z = depth * pidp50;
vec.Z = depth * PID_P * 50;
Vector3 n = m_parent_scene.GetTerrainNormalAtXY(tmpX, tmpY);
if (!m_flying)
{
vec.Z += -vel.Z * PID_D;
vec.Z -= vel.Z * PID_D;
if (n.Z < 0.4f)
{
vec.X = depth * PID_P * 50f - vel.X * PID_D;
vec.X = depth * pidp50 - vel.X * PID_D;
vec.X *= n.X;
vec.Y = depth * PID_P * 50f - vel.Y * PID_D;
vec.Y = depth * pidp50 - vel.Y * PID_D;
vec.Y *= n.Y;
vec.Z *= n.Z;
if (n.Z < 0.1f)
@@ -1322,9 +1318,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
CharacterFeet = true
};
AddCollisionEvent(0,contact);
m_lastFallVel = vel;
//vec.Z *= 0.5f;
m_lastFallVel = Vector3.Zero;
}
}
@@ -1399,8 +1393,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (!m_iscolliding)
CollideNormal.Z = 0;
if (!tviszero)
{
m_freemove = false;
@@ -1567,7 +1559,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (m_flying || hoverPIDActive)
{
vec.Z -= m_sceneGravityZ * m_mass;
vec.Z -= m_scenegravityForceZ;
if (!hoverPIDActive)
{
@@ -1912,7 +1904,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
SafeNativeMethods.MassSetBoxTotal(out ShellMass, m_mass, 2f * sx, 2f * sy, 2f * sz);
SafeNativeMethods.BodySetMass(Body, ref ShellMass);
m_scenegravityForceZ = m_sceneGravityZ * m_mass;
m_scenegravityForceZ = m_parent_scene.gravityz * m_mass;
_position.Z += sz - oldsz;
SafeNativeMethods.BodySetPosition(Body, _position.X, _position.Y, _position.Z);

View File

@@ -773,14 +773,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
public override bool FloatOnWater
{
set
{
//AddChange(changes.CollidesWater, value);
}
}
public override Vector3 PIDTarget
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]

View File

@@ -137,7 +137,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
PhysRepData,
AddPhysRep,
CollidesWater,
VolumeDtc,
Physical,