* Highly experimental ODE_STEPSIZE = 0.025f - 1000 / 25 = 40fps - 10 substeps with fallback to 5 substeps when things get slow
* Just to give you an idea of the difference .. previous ODE_STEPSIZE was 0.005f - 1000/5 = 200fps - 10 substeps with fallback to 5 substeps when things get slow * *nix avatar may fall over again, *sorry*ThreadPoolClientBranch
parent
254e047dad
commit
205001ab8d
|
@ -68,8 +68,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private float m_mass = 80f;
|
private float m_mass = 80f;
|
||||||
private float m_density = 60f;
|
private float m_density = 60f;
|
||||||
private bool m_pidControllerActive = true;
|
private bool m_pidControllerActive = true;
|
||||||
private static float PID_D = 3020.0f;
|
private float PID_D = 800.0f;
|
||||||
private static float PID_P = 7000.0f;
|
private float PID_P = 900.0f;
|
||||||
private static float POSTURE_SERVO = 10000.0f;
|
private static float POSTURE_SERVO = 10000.0f;
|
||||||
public static float CAPSULE_RADIUS = 0.37f;
|
public static float CAPSULE_RADIUS = 0.37f;
|
||||||
public float CAPSULE_LENGTH = 2.140599f;
|
public float CAPSULE_LENGTH = 2.140599f;
|
||||||
|
@ -112,11 +112,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
if (System.Environment.OSVersion.Platform == PlatformID.Unix)
|
if (System.Environment.OSVersion.Platform == PlatformID.Unix)
|
||||||
{
|
{
|
||||||
m_foundDebian = true;
|
m_foundDebian = true;
|
||||||
m_tensor = 14000000f;
|
m_tensor = 1000000f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_tensor = 3800000f;
|
m_tensor = 1000000f;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_StandUpRotation =
|
m_StandUpRotation =
|
||||||
|
@ -384,7 +384,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
d.GeomSetBody(Shell, Body);
|
d.GeomSetBody(Shell, Body);
|
||||||
|
|
||||||
|
|
||||||
// The purpose of the AMotor here is to keep the avatar's physical
|
// The purpose of the AMotor here is to keep the avatar's physical
|
||||||
// surrogate from rotating while moving
|
// surrogate from rotating while moving
|
||||||
Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
|
Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
|
||||||
|
@ -562,6 +562,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// If the PID Controller isn't active then we set our force
|
// If the PID Controller isn't active then we set our force
|
||||||
// calculating base velocity to the current position
|
// calculating base velocity to the current position
|
||||||
|
|
||||||
|
|
||||||
if (m_pidControllerActive == false)
|
if (m_pidControllerActive == false)
|
||||||
{
|
{
|
||||||
_zeroPosition = d.BodyGetPosition(Body);
|
_zeroPosition = d.BodyGetPosition(Body);
|
||||||
|
@ -598,11 +599,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// Prim to avatar collisions
|
// Prim to avatar collisions
|
||||||
|
|
||||||
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;
|
vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * PID_P;
|
||||||
vec.Y = (_target_velocity.Y - vel.Y)*PID_D + (_zeroPosition.Y - pos.Y)*PID_P;
|
vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)*PID_P;
|
||||||
if (flying)
|
if (flying)
|
||||||
{
|
{
|
||||||
vec.Z = (_target_velocity.Z - vel.Z)*(PID_D + 5100) + (_zeroPosition.Z - pos.Z)*PID_P;
|
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//PidStatus = true;
|
//PidStatus = true;
|
||||||
|
@ -650,12 +651,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
if (flying)
|
if (flying)
|
||||||
{
|
{
|
||||||
vec.Z = (_target_velocity.Z - vel.Z)*(PID_D + 5100);
|
vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flying)
|
if (flying)
|
||||||
{
|
{
|
||||||
vec.Z += 10.0f;
|
vec.Z += (9.8f*m_mass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private const uint m_regionWidth = 256;
|
private const uint m_regionWidth = 256;
|
||||||
private const uint m_regionHeight = 256;
|
private const uint m_regionHeight = 256;
|
||||||
|
|
||||||
private static float ODE_STEPSIZE = 0.004f;
|
private static float ODE_STEPSIZE = 0.025f;
|
||||||
private static bool RENDER_FLAG = false;
|
private static bool RENDER_FLAG = false;
|
||||||
private static float metersInSpace = 29.9f;
|
private static float metersInSpace = 29.9f;
|
||||||
private IntPtr contactgroup;
|
private IntPtr contactgroup;
|
||||||
|
@ -1087,7 +1087,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
// Figure out the Frames Per Second we're going at.
|
// Figure out the Frames Per Second we're going at.
|
||||||
//(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
|
//(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
|
||||||
fps = ((step_time/ODE_STEPSIZE)*(m_physicsiterations*250));
|
fps = (step_time/ODE_STEPSIZE) * 1000;
|
||||||
|
|
||||||
|
|
||||||
while (step_time > 0.0f)
|
while (step_time > 0.0f)
|
||||||
|
|
Loading…
Reference in New Issue