Experimental change of PhysicsVector to Vector3. Untested
parent
b6651ce790
commit
d199767e69
|
@ -264,10 +264,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
|||
avatar.ControllingClient.SendAlertMessage(
|
||||
"You are not allowed on this parcel because you are banned. Please go away.");
|
||||
|
||||
avatar.PhysicsActor.Position =
|
||||
new PhysicsVector(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y,
|
||||
avatar.lastKnownAllowedPosition.Z);
|
||||
avatar.PhysicsActor.Velocity = new PhysicsVector(0, 0, 0);
|
||||
avatar.PhysicsActor.Position = avatar.lastKnownAllowedPosition;
|
||||
avatar.PhysicsActor.Velocity = Vector3.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4606,7 +4606,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
case PhysicsJointType.Ball:
|
||||
{
|
||||
PhysicsVector jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
||||
Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
||||
Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z);
|
||||
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
|
||||
}
|
||||
|
@ -4614,7 +4614,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
case PhysicsJointType.Hinge:
|
||||
{
|
||||
PhysicsVector jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
||||
Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
|
||||
|
||||
// Normally, we would just ask the physics scene to return the axis for the joint.
|
||||
// Unfortunately, ODE sometimes returns <0,0,0> for the joint axis, which should
|
||||
|
|
|
@ -1479,8 +1479,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
|
||||
dupe.RootPart.Name,
|
||||
pbs,
|
||||
new PhysicsVector(dupe.RootPart.AbsolutePosition.X, dupe.RootPart.AbsolutePosition.Y, dupe.RootPart.AbsolutePosition.Z),
|
||||
new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
|
||||
dupe.RootPart.AbsolutePosition,
|
||||
dupe.RootPart.Scale,
|
||||
dupe.RootPart.RotationOffset,
|
||||
dupe.RootPart.PhysActor.IsPhysical);
|
||||
|
||||
|
@ -1595,7 +1595,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
*/
|
||||
}
|
||||
|
||||
public void applyImpulse(PhysicsVector impulse)
|
||||
public void applyImpulse(Vector3 impulse)
|
||||
{
|
||||
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
||||
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
||||
|
@ -1622,7 +1622,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void applyAngularImpulse(PhysicsVector impulse)
|
||||
public void applyAngularImpulse(Vector3 impulse)
|
||||
{
|
||||
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
||||
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
||||
|
@ -1641,7 +1641,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void setAngularImpulse(PhysicsVector impulse)
|
||||
public void setAngularImpulse(Vector3 impulse)
|
||||
{
|
||||
// We check if rootpart is null here because scripts don't delete if you delete the host.
|
||||
// This means that unfortunately, we can pass a null physics actor to Simulate!
|
||||
|
@ -1672,8 +1672,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (!IsAttachment)
|
||||
{
|
||||
PhysicsVector torque = rootpart.PhysActor.Torque;
|
||||
return new Vector3(torque.X, torque.Y, torque.Z);
|
||||
Vector3 torque = rootpart.PhysActor.Torque;
|
||||
return torque;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1706,7 +1706,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (rootpart.PhysActor != null)
|
||||
{
|
||||
rootpart.PhysActor.PIDTarget = new PhysicsVector(target.X, target.Y, target.Z);
|
||||
rootpart.PhysActor.PIDTarget = target;
|
||||
rootpart.PhysActor.PIDTau = tau;
|
||||
rootpart.PhysActor.PIDActive = true;
|
||||
}
|
||||
|
@ -2374,7 +2374,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_rootPart.PhysActor.IsPhysical)
|
||||
{
|
||||
Vector3 llmoveforce = pos - AbsolutePosition;
|
||||
PhysicsVector grabforce = new PhysicsVector(llmoveforce.X, llmoveforce.Y, llmoveforce.Z);
|
||||
Vector3 grabforce = llmoveforce;
|
||||
grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
|
||||
m_rootPart.PhysActor.AddForce(grabforce,true);
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
||||
|
@ -2479,7 +2479,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
rotationAxis.Normalize();
|
||||
|
||||
//m_log.Error("SCENE OBJECT GROUP]: rotation axis is " + rotationAxis);
|
||||
PhysicsVector spinforce = new PhysicsVector(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
|
||||
Vector3 spinforce = new Vector3(rotationAxis.X, rotationAxis.Y, rotationAxis.Z);
|
||||
spinforce = (spinforce/8) * m_rootPart.PhysActor.Mass; // 8 is an arbitrary torque scaling factor
|
||||
m_rootPart.PhysActor.AddAngularForce(spinforce,true);
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
|
||||
|
@ -2706,8 +2706,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (scale.Z > m_scene.m_maxPhys)
|
||||
scale.Z = m_scene.m_maxPhys;
|
||||
}
|
||||
part.PhysActor.Size =
|
||||
new PhysicsVector(scale.X, scale.Y, scale.Z);
|
||||
part.PhysActor.Size = scale;
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
|
||||
}
|
||||
//if (part.UUID != m_rootPart.UUID)
|
||||
|
@ -2851,8 +2850,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (part.PhysActor != null)
|
||||
{
|
||||
part.PhysActor.Size =
|
||||
new PhysicsVector(prevScale.X, prevScale.Y, prevScale.Z);
|
||||
part.PhysActor.Size = prevScale;
|
||||
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
|
||||
}
|
||||
|
||||
|
|
|
@ -167,9 +167,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
[XmlIgnore]
|
||||
public uint AttachmentPoint;
|
||||
|
||||
|
||||
[XmlIgnore]
|
||||
public PhysicsVector RotationAxis = new PhysicsVector(1f, 1f, 1f);
|
||||
public Vector3 RotationAxis = Vector3.One;
|
||||
|
||||
[XmlIgnore]
|
||||
public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this
|
||||
|
@ -537,13 +537,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Root prim actually goes at Position
|
||||
if (_parentID == 0)
|
||||
{
|
||||
PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
PhysActor.Position = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// To move the child prim in respect to the group position and rotation we have to calculate
|
||||
Vector3 resultingposition = GetWorldPosition();
|
||||
PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
|
||||
PhysActor.Position = resultingposition;
|
||||
Quaternion resultingrot = GetWorldRotation();
|
||||
PhysActor.Orientation = resultingrot;
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (_parentID != 0 && PhysActor != null)
|
||||
{
|
||||
Vector3 resultingposition = GetWorldPosition();
|
||||
PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z);
|
||||
PhysActor.Position = resultingposition;
|
||||
Quaternion resultingrot = GetWorldRotation();
|
||||
PhysActor.Orientation = resultingrot;
|
||||
|
||||
|
@ -675,7 +675,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (PhysActor.IsPhysical)
|
||||
{
|
||||
PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
PhysActor.Velocity = value;
|
||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
||||
}
|
||||
}
|
||||
|
@ -817,7 +817,7 @@ if (m_shape != null) {
|
|||
{
|
||||
if (m_parentGroup.Scene.PhysicsScene != null)
|
||||
{
|
||||
PhysActor.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z);
|
||||
PhysActor.Size = m_shape.Scale;
|
||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
||||
}
|
||||
}
|
||||
|
@ -1225,7 +1225,7 @@ if (m_shape != null) {
|
|||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||
public void ApplyImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||
{
|
||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
||||
Vector3 impulse = impulsei;
|
||||
|
||||
if (localGlobalTF)
|
||||
{
|
||||
|
@ -1233,7 +1233,7 @@ if (m_shape != null) {
|
|||
Quaternion AXgrot = grot;
|
||||
Vector3 AXimpulsei = impulsei;
|
||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
||||
impulse = newimpulse;
|
||||
}
|
||||
|
||||
if (m_parentGroup != null)
|
||||
|
@ -1251,7 +1251,7 @@ if (m_shape != null) {
|
|||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||
public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||
{
|
||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
||||
Vector3 impulse = impulsei;
|
||||
|
||||
if (localGlobalTF)
|
||||
{
|
||||
|
@ -1259,7 +1259,7 @@ if (m_shape != null) {
|
|||
Quaternion AXgrot = grot;
|
||||
Vector3 AXimpulsei = impulsei;
|
||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
||||
impulse = newimpulse;
|
||||
}
|
||||
|
||||
if (m_parentGroup != null)
|
||||
|
@ -1277,7 +1277,7 @@ if (m_shape != null) {
|
|||
/// <param name="localGlobalTF">true for the local frame, false for the global frame</param>
|
||||
public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF)
|
||||
{
|
||||
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
|
||||
Vector3 impulse = impulsei;
|
||||
|
||||
if (localGlobalTF)
|
||||
{
|
||||
|
@ -1285,7 +1285,7 @@ if (m_shape != null) {
|
|||
Quaternion AXgrot = grot;
|
||||
Vector3 AXimpulsei = impulsei;
|
||||
Vector3 newimpulse = AXimpulsei * AXgrot;
|
||||
impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
|
||||
impulse = newimpulse;
|
||||
}
|
||||
|
||||
if (m_parentGroup != null)
|
||||
|
@ -1333,8 +1333,8 @@ if (m_shape != null) {
|
|||
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||
Name,
|
||||
Shape,
|
||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
||||
AbsolutePosition,
|
||||
Scale,
|
||||
RotationOffset,
|
||||
RigidBody);
|
||||
|
||||
|
@ -1523,7 +1523,7 @@ if (m_shape != null) {
|
|||
PhysicsJoint joint;
|
||||
|
||||
joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
|
||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
||||
AbsolutePosition,
|
||||
this.RotationOffset,
|
||||
Description,
|
||||
bodyNames,
|
||||
|
@ -1708,12 +1708,12 @@ if (m_shape != null) {
|
|||
}
|
||||
}
|
||||
|
||||
public PhysicsVector GetForce()
|
||||
public Vector3 GetForce()
|
||||
{
|
||||
if (PhysActor != null)
|
||||
return PhysActor.Force;
|
||||
else
|
||||
return new PhysicsVector();
|
||||
return Vector3.Zero;
|
||||
}
|
||||
|
||||
public void GetProperties(IClientAPI client)
|
||||
|
@ -2078,7 +2078,7 @@ if (m_shape != null) {
|
|||
}
|
||||
}
|
||||
|
||||
public void PhysicsOutOfBounds(PhysicsVector pos)
|
||||
public void PhysicsOutOfBounds(Vector3 pos)
|
||||
{
|
||||
m_log.Error("[PHYSICS]: Physical Object went out of bounds.");
|
||||
|
||||
|
@ -2564,7 +2564,7 @@ if (m_shape != null) {
|
|||
}
|
||||
}
|
||||
|
||||
public void SetForce(PhysicsVector force)
|
||||
public void SetForce(Vector3 force)
|
||||
{
|
||||
if (PhysActor != null)
|
||||
{
|
||||
|
@ -2588,7 +2588,7 @@ if (m_shape != null) {
|
|||
}
|
||||
}
|
||||
|
||||
public void SetVehicleVectorParam(int param, PhysicsVector value)
|
||||
public void SetVehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
if (PhysActor != null)
|
||||
{
|
||||
|
@ -3430,8 +3430,8 @@ if (m_shape != null) {
|
|||
PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
|
||||
Name,
|
||||
Shape,
|
||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z),
|
||||
new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
|
||||
AbsolutePosition,
|
||||
Scale,
|
||||
RotationOffset,
|
||||
UsePhysics);
|
||||
|
||||
|
|
|
@ -434,7 +434,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
lock (m_scene.SyncRoot)
|
||||
{
|
||||
m_physicsActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
m_physicsActor.Position = value;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -474,7 +474,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
lock (m_scene.SyncRoot)
|
||||
{
|
||||
m_physicsActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
m_physicsActor.Velocity = value;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -1046,7 +1046,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_avHeight = height;
|
||||
if (PhysicsActor != null && !IsChildAgent)
|
||||
{
|
||||
PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight);
|
||||
Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight);
|
||||
PhysicsActor.Size = SetSize;
|
||||
}
|
||||
}
|
||||
|
@ -3345,20 +3345,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
PhysicsScene scene = m_scene.PhysicsScene;
|
||||
|
||||
PhysicsVector pVec =
|
||||
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
|
||||
AbsolutePosition.Z);
|
||||
Vector3 pVec = AbsolutePosition;
|
||||
|
||||
// Old bug where the height was in centimeters instead of meters
|
||||
if (m_avHeight == 127.0f)
|
||||
{
|
||||
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f),
|
||||
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f),
|
||||
isFlying);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
|
||||
new PhysicsVector(0, 0, m_avHeight), isFlying);
|
||||
new Vector3(0f, 0f, m_avHeight), isFlying);
|
||||
}
|
||||
scene.AddPhysicsActorTaint(m_physicsActor);
|
||||
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
|
||||
|
@ -3369,7 +3367,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
}
|
||||
|
||||
private void OutOfBoundsCall(PhysicsVector pos)
|
||||
private void OutOfBoundsCall(Vector3 pos)
|
||||
{
|
||||
//bool flying = m_physicsActor.Flying;
|
||||
//RemoveFromPhysicalScene();
|
||||
|
@ -3592,7 +3590,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
*/
|
||||
}
|
||||
|
||||
internal void PushForce(PhysicsVector impulse)
|
||||
internal void PushForce(Vector3 impulse)
|
||||
{
|
||||
if (PhysicsActor != null)
|
||||
{
|
||||
|
|
|
@ -525,8 +525,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector tmp = GetSOP().PhysActor.GeometricCenter;
|
||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
||||
Vector3 tmp = GetSOP().PhysActor.GeometricCenter;
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -534,8 +534,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector tmp = GetSOP().PhysActor.CenterOfMass;
|
||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
||||
Vector3 tmp = GetSOP().PhysActor.CenterOfMass;
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,15 +543,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector tmp = GetSOP().PhysActor.RotationalVelocity;
|
||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
||||
Vector3 tmp = GetSOP().PhysActor.RotationalVelocity;
|
||||
return tmp;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!CanEdit())
|
||||
return;
|
||||
|
||||
GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
GetSOP().PhysActor.RotationalVelocity = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,15 +559,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector tmp = GetSOP().PhysActor.Velocity;
|
||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
||||
Vector3 tmp = GetSOP().PhysActor.Velocity;
|
||||
return tmp;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!CanEdit())
|
||||
return;
|
||||
|
||||
GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
GetSOP().PhysActor.Velocity = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -575,15 +575,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector tmp = GetSOP().PhysActor.Torque;
|
||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
||||
Vector3 tmp = GetSOP().PhysActor.Torque;
|
||||
return tmp;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!CanEdit())
|
||||
return;
|
||||
|
||||
GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
GetSOP().PhysActor.Torque = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -591,8 +591,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector tmp = GetSOP().PhysActor.Acceleration;
|
||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
||||
Vector3 tmp = GetSOP().PhysActor.Acceleration;
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -600,15 +600,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector tmp = GetSOP().PhysActor.Force;
|
||||
return new Vector3(tmp.X, tmp.Y, tmp.Z);
|
||||
Vector3 tmp = GetSOP().PhysActor.Force;
|
||||
return tmp;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!CanEdit())
|
||||
return;
|
||||
|
||||
GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z);
|
||||
GetSOP().PhysActor.Force = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
if (!CanEdit())
|
||||
return;
|
||||
|
||||
GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce);
|
||||
GetSOP().PhysActor.AddForce(force, pushforce);
|
||||
}
|
||||
|
||||
public void AddAngularForce(Vector3 force, bool pushforce)
|
||||
|
@ -635,7 +635,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
if (!CanEdit())
|
||||
return;
|
||||
|
||||
GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce);
|
||||
GetSOP().PhysActor.AddAngularForce(force, pushforce);
|
||||
}
|
||||
|
||||
public void SetMomentum(Vector3 momentum)
|
||||
|
@ -643,7 +643,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
if (!CanEdit())
|
||||
return;
|
||||
|
||||
GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z));
|
||||
GetSOP().PhysActor.SetMomentum(momentum);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -36,20 +36,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
{
|
||||
public class BasicActor : PhysicsActor
|
||||
{
|
||||
private PhysicsVector _position;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _acceleration;
|
||||
private PhysicsVector _size;
|
||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
||||
private Vector3 _position;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 _acceleration;
|
||||
private Vector3 _size;
|
||||
private Vector3 m_rotationalVelocity;
|
||||
private bool flying;
|
||||
private bool iscolliding;
|
||||
|
||||
public BasicActor()
|
||||
{
|
||||
_velocity = new PhysicsVector();
|
||||
_position = new PhysicsVector();
|
||||
_acceleration = new PhysicsVector();
|
||||
_size = new PhysicsVector();
|
||||
}
|
||||
|
||||
public override int PhysicsActorType
|
||||
|
@ -58,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
|
@ -137,13 +133,13 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
set { _position = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return _size; }
|
||||
set {
|
||||
|
@ -162,9 +158,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
get { return 0f; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -179,7 +175,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -194,25 +190,25 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
set { _velocity = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -228,7 +224,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
set { }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
@ -247,24 +243,24 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetAcceleration(PhysicsVector accel)
|
||||
public void SetAcceleration(Vector3 accel)
|
||||
{
|
||||
_acceleration = accel;
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -272,7 +268,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget
|
||||
public override Vector3 PIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
{
|
||||
|
||||
}
|
||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
{
|
||||
BasicActor act = new BasicActor();
|
||||
act.Position = position;
|
||||
|
@ -77,20 +77,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
}
|
||||
|
||||
/*
|
||||
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
||||
public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation)
|
||||
{
|
||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -105,26 +105,28 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
for (int i = 0; i < _actors.Count; ++i)
|
||||
{
|
||||
BasicActor actor = _actors[i];
|
||||
Vector3 actorPosition = actor.Position;
|
||||
Vector3 actorVelocity = actor.Velocity;
|
||||
|
||||
actor.Position.X += actor.Velocity.X*timeStep;
|
||||
actor.Position.Y += actor.Velocity.Y*timeStep;
|
||||
actorPosition.X += actor.Velocity.X*timeStep;
|
||||
actorPosition.Y += actor.Velocity.Y*timeStep;
|
||||
|
||||
if (actor.Position.Y < 0)
|
||||
{
|
||||
actor.Position.Y = 0.1F;
|
||||
actorPosition.Y = 0.1F;
|
||||
}
|
||||
else if (actor.Position.Y >= Constants.RegionSize)
|
||||
{
|
||||
actor.Position.Y = ((int)Constants.RegionSize - 0.1f);
|
||||
actorPosition.Y = ((int)Constants.RegionSize - 0.1f);
|
||||
}
|
||||
|
||||
if (actor.Position.X < 0)
|
||||
{
|
||||
actor.Position.X = 0.1F;
|
||||
actorPosition.X = 0.1F;
|
||||
}
|
||||
else if (actor.Position.X >= Constants.RegionSize)
|
||||
{
|
||||
actor.Position.X = ((int)Constants.RegionSize - 0.1f);
|
||||
actorPosition.X = ((int)Constants.RegionSize - 0.1f);
|
||||
}
|
||||
|
||||
float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z;
|
||||
|
@ -133,23 +135,27 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
|
||||
_heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
|
||||
{
|
||||
actor.Position.Z = height;
|
||||
actor.Velocity.Z = 0;
|
||||
actorPosition.Z = height;
|
||||
actorVelocity.Z = 0;
|
||||
actor.IsColliding = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
actor.Position.Z += actor.Velocity.Z*timeStep;
|
||||
actorPosition.Z += actor.Velocity.Z*timeStep;
|
||||
actor.IsColliding = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
actor.Position.Z = height;
|
||||
actor.Velocity.Z = 0;
|
||||
actorPosition.Z = height;
|
||||
actorVelocity.Z = 0;
|
||||
actor.IsColliding = true;
|
||||
}
|
||||
|
||||
actor.Position = actorPosition;
|
||||
actor.Velocity = actorVelocity;
|
||||
}
|
||||
|
||||
return fps;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,15 +60,15 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
private btQuaternion m_bodyOrientation;
|
||||
private btDefaultMotionState m_bodyMotionState;
|
||||
private btGeneric6DofConstraint m_aMotor;
|
||||
// private PhysicsVector m_movementComparision;
|
||||
private PhysicsVector m_position;
|
||||
private PhysicsVector m_zeroPosition;
|
||||
// private Vector3 m_movementComparision;
|
||||
private Vector3 m_position;
|
||||
private Vector3 m_zeroPosition;
|
||||
private bool m_zeroFlag = false;
|
||||
private bool m_lastUpdateSent = false;
|
||||
private PhysicsVector m_velocity;
|
||||
private PhysicsVector m_target_velocity;
|
||||
private PhysicsVector m_acceleration;
|
||||
private PhysicsVector m_rotationalVelocity;
|
||||
private Vector3 m_velocity;
|
||||
private Vector3 m_target_velocity;
|
||||
private Vector3 m_acceleration;
|
||||
private Vector3 m_rotationalVelocity;
|
||||
private bool m_pidControllerActive = true;
|
||||
public float PID_D = 80.0f;
|
||||
public float PID_P = 90.0f;
|
||||
|
@ -96,8 +96,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes.
|
||||
private bool m_taintRemove = false;
|
||||
// private bool m_taintedPosition = false;
|
||||
// private PhysicsVector m_taintedPosition_value;
|
||||
private PhysicsVector m_taintedForce;
|
||||
// private Vector3 m_taintedPosition_value;
|
||||
private Vector3 m_taintedForce;
|
||||
|
||||
private float m_buoyancy = 0f;
|
||||
|
||||
|
@ -115,14 +115,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
public int m_eventsubscription = 0;
|
||||
// private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||
|
||||
public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, PhysicsVector pos, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
|
||||
public BulletDotNETCharacter(string avName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
|
||||
{
|
||||
m_taintedForce = new PhysicsVector();
|
||||
m_velocity = new PhysicsVector();
|
||||
m_target_velocity = new PhysicsVector();
|
||||
m_position = pos;
|
||||
m_zeroPosition = new PhysicsVector(pos.X, pos.Y, pos.Z); // this is a class, not a struct. Must make new, or m_zeroPosition will == position regardless
|
||||
m_acceleration = new PhysicsVector();
|
||||
m_zeroPosition = pos;
|
||||
m_parent_scene = parent_scene;
|
||||
PID_D = pid_d;
|
||||
PID_P = pid_p;
|
||||
|
@ -161,9 +157,6 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
tempTrans1 = new btTransform(tempQuat1, tempVector1);
|
||||
// m_movementComparision = new PhysicsVector(0, 0, 0);
|
||||
m_CapsuleOrientationAxis = new btVector3(1, 0, 1);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -254,18 +247,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
get { return m_zeroFlag; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return new PhysicsVector(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
||||
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
||||
set
|
||||
{
|
||||
m_pidControllerActive = true;
|
||||
|
||||
PhysicsVector SetSize = value;
|
||||
|
||||
Vector3 SetSize = value;
|
||||
m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
||||
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
|
||||
|
||||
Velocity = new PhysicsVector(0f, 0f, 0f);
|
||||
Velocity = Vector3.Zero;
|
||||
|
||||
m_parent_scene.AddPhysicsActorTaint(this);
|
||||
}
|
||||
|
@ -317,12 +310,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return m_position; }
|
||||
set
|
||||
|
@ -342,9 +335,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return new PhysicsVector(m_target_velocity.X, m_target_velocity.Y, m_target_velocity.Z); }
|
||||
get { return m_target_velocity; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -359,7 +352,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -374,23 +367,22 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get
|
||||
{
|
||||
// There's a problem with PhysicsVector.Zero! Don't Use it Here!
|
||||
if (m_zeroFlag)
|
||||
return new PhysicsVector(0f, 0f, 0f);
|
||||
return Vector3.Zero;
|
||||
m_lastUpdateSent = false;
|
||||
return m_velocity;
|
||||
}
|
||||
|
@ -401,9 +393,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -413,7 +405,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
set { }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return m_acceleration; }
|
||||
}
|
||||
|
@ -586,7 +578,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
|
@ -604,7 +596,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
set { m_buoyancy = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget { set { return; } }
|
||||
public override Vector3 PIDTarget { set { return; } }
|
||||
public override bool PIDActive { set { return; } }
|
||||
public override float PIDTau { set { return; } }
|
||||
|
||||
|
@ -634,7 +626,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
/// </summary>
|
||||
/// <param name="force"></param>
|
||||
/// <param name="pushforce">Is this a push by a script?</param>
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
if (pushforce)
|
||||
{
|
||||
|
@ -656,7 +648,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
//m_lastUpdateSent = false;
|
||||
}
|
||||
|
||||
public void doForce(PhysicsVector force, bool now)
|
||||
public void doForce(Vector3 force, bool now)
|
||||
{
|
||||
|
||||
tempVector3.setValue(force.X, force.Y, force.Z);
|
||||
|
@ -671,7 +663,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public void doImpulse(PhysicsVector force, bool now)
|
||||
public void doImpulse(Vector3 force, bool now)
|
||||
{
|
||||
|
||||
tempVector3.setValue(force.X, force.Y, force.Z);
|
||||
|
@ -686,12 +678,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -808,7 +800,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
AvatarGeomAndBodyCreation(m_position.X, m_position.Y,
|
||||
m_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2));
|
||||
Velocity = new PhysicsVector(0f, 0f, 0f);
|
||||
Velocity = Vector3.Zero;
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -852,9 +844,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
//PidStatus = true;
|
||||
|
||||
PhysicsVector vec = new PhysicsVector();
|
||||
Vector3 vec = Vector3.Zero;
|
||||
|
||||
PhysicsVector vel = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
|
||||
Vector3 vel = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
|
||||
|
||||
float movementdivisor = 1f;
|
||||
|
||||
|
@ -885,7 +877,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
// Avatar to Avatar collisions
|
||||
// Prim to avatar collisions
|
||||
|
||||
PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
||||
Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
||||
vec.X = (m_target_velocity.X - vel.X) * (PID_D) + (m_zeroPosition.X - pos.X) * (PID_P * 2);
|
||||
vec.Y = (m_target_velocity.Y - vel.Y) * (PID_D) + (m_zeroPosition.Y - pos.Y) * (PID_P * 2);
|
||||
if (m_flying)
|
||||
|
@ -927,7 +919,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
{
|
||||
// We're colliding with something and we're not flying but we're moving
|
||||
// This means we're walking or running.
|
||||
PhysicsVector pos = new PhysicsVector(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
||||
Vector3 pos = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
||||
vec.Z = (m_target_velocity.Z - vel.Z) * PID_D + (m_zeroPosition.Z - pos.Z) * PID_P;
|
||||
if (m_target_velocity.X > 0)
|
||||
{
|
||||
|
@ -1016,7 +1008,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
tempVector2 = Body.getInterpolationLinearVelocity();
|
||||
|
||||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
||||
PhysicsVector vec = new PhysicsVector(tempVector1.getX(),tempVector1.getY(),tempVector1.getZ());
|
||||
Vector3 vec = new Vector3(tempVector1.getX(), tempVector1.getY(), tempVector1.getZ());
|
||||
|
||||
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
|
||||
if (vec.X < -10.0f) vec.X = 0.0f;
|
||||
|
@ -1048,7 +1040,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
else
|
||||
{
|
||||
m_lastUpdateSent = false;
|
||||
vec = new PhysicsVector(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
|
||||
vec = new Vector3(tempVector2.getX(), tempVector2.getY(), tempVector2.getZ());
|
||||
m_velocity.X = (vec.X);
|
||||
m_velocity.Y = (vec.Y);
|
||||
|
||||
|
|
|
@ -43,44 +43,43 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private PhysicsVector _position;
|
||||
private PhysicsVector m_zeroPosition;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _torque = new PhysicsVector(0, 0, 0);
|
||||
private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
private Quaternion m_lastorientation = new Quaternion();
|
||||
private PhysicsVector m_rotationalVelocity;
|
||||
private PhysicsVector _size;
|
||||
private PhysicsVector _acceleration;
|
||||
private Vector3 _position;
|
||||
private Vector3 m_zeroPosition;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 _torque;
|
||||
private Vector3 m_lastVelocity;
|
||||
private Vector3 m_lastposition;
|
||||
private Quaternion m_lastorientation = Quaternion.Identity;
|
||||
private Vector3 m_rotationalVelocity;
|
||||
private Vector3 _size;
|
||||
private Vector3 _acceleration;
|
||||
// private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
|
||||
private Quaternion _orientation;
|
||||
private PhysicsVector m_taintposition;
|
||||
private PhysicsVector m_taintsize;
|
||||
private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0);
|
||||
private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0);
|
||||
private Vector3 m_taintposition;
|
||||
private Vector3 m_taintsize;
|
||||
private Vector3 m_taintVelocity;
|
||||
private Vector3 m_taintTorque;
|
||||
private Quaternion m_taintrot;
|
||||
private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f);
|
||||
private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f);
|
||||
private Vector3 m_angularlock = Vector3.One;
|
||||
private Vector3 m_taintAngularLock = Vector3.One;
|
||||
// private btGeneric6DofConstraint Amotor;
|
||||
|
||||
private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0);
|
||||
private float m_PIDTau = 0f;
|
||||
private float m_PIDHoverHeight = 0f;
|
||||
private float m_PIDHoverTau = 0f;
|
||||
private bool m_useHoverPID = false;
|
||||
private Vector3 m_PIDTarget;
|
||||
private float m_PIDTau;
|
||||
private float m_PIDHoverHeight;
|
||||
private float m_PIDHoverTau;
|
||||
private bool m_useHoverPID;
|
||||
private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
|
||||
private float m_targetHoverHeight = 0f;
|
||||
private float m_groundHeight = 0f;
|
||||
private float m_waterHeight = 0f;
|
||||
private float m_targetHoverHeight;
|
||||
private float m_groundHeight;
|
||||
private float m_waterHeight;
|
||||
private float PID_D = 35f;
|
||||
private float PID_G = 25f;
|
||||
// private float m_tensor = 5f;
|
||||
// private int body_autodisable_frames = 20;
|
||||
private IMesh primMesh = null;
|
||||
|
||||
private bool m_usePID = false;
|
||||
private IMesh primMesh;
|
||||
|
||||
private bool m_usePID;
|
||||
|
||||
private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
|
||||
| CollisionCategories.Space
|
||||
|
@ -88,11 +87,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
| CollisionCategories.Character
|
||||
);
|
||||
|
||||
private bool m_taintshape = false;
|
||||
private bool m_taintPhysics = false;
|
||||
private bool m_taintshape;
|
||||
private bool m_taintPhysics;
|
||||
// private bool m_collidesLand = true;
|
||||
private bool m_collidesWater = false;
|
||||
public bool m_returnCollisions = false;
|
||||
private bool m_collidesWater;
|
||||
public bool m_returnCollisions;
|
||||
|
||||
// Default we're a Geometry
|
||||
// private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
|
||||
|
@ -100,23 +99,23 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
// Default, Collide with Other Geometries, spaces and Bodies
|
||||
// private CollisionCategories m_collisionFlags = m_default_collisionFlags;
|
||||
|
||||
public bool m_taintremove = false;
|
||||
public bool m_taintdisable = false;
|
||||
public bool m_disabled = false;
|
||||
public bool m_taintadd = false;
|
||||
public bool m_taintselected = false;
|
||||
public bool m_taintCollidesWater = false;
|
||||
public bool m_taintremove;
|
||||
public bool m_taintdisable;
|
||||
public bool m_disabled;
|
||||
public bool m_taintadd;
|
||||
public bool m_taintselected;
|
||||
public bool m_taintCollidesWater;
|
||||
|
||||
public uint m_localID = 0;
|
||||
public uint m_localID;
|
||||
|
||||
//public GCHandle gc;
|
||||
// private CollisionLocker ode;
|
||||
|
||||
private bool m_taintforce = false;
|
||||
private bool m_taintaddangularforce = false;
|
||||
private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
|
||||
private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>();
|
||||
private bool m_taintforce;
|
||||
private bool m_taintaddangularforce;
|
||||
private Vector3 m_force;
|
||||
private List<Vector3> m_forcelist = new List<Vector3>();
|
||||
private List<Vector3> m_angularforcelist = new List<Vector3>();
|
||||
|
||||
private IMesh _mesh;
|
||||
private PrimitiveBaseShape _pbs;
|
||||
|
@ -124,40 +123,40 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
public btCollisionShape prim_geom;
|
||||
public IntPtr _triMeshData;
|
||||
|
||||
private PhysicsActor _parent = null;
|
||||
private PhysicsActor m_taintparent = null;
|
||||
private PhysicsActor _parent;
|
||||
private PhysicsActor m_taintparent;
|
||||
|
||||
private List<BulletDotNETPrim> childrenPrim = new List<BulletDotNETPrim>();
|
||||
|
||||
private bool iscolliding = false;
|
||||
private bool m_isphysical = false;
|
||||
private bool m_isSelected = false;
|
||||
private bool iscolliding;
|
||||
private bool m_isphysical;
|
||||
private bool m_isSelected;
|
||||
|
||||
internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively
|
||||
internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
|
||||
|
||||
private bool m_throttleUpdates = false;
|
||||
// private int throttleCounter = 0;
|
||||
public int m_interpenetrationcount = 0;
|
||||
public float m_collisionscore = 0;
|
||||
public int m_roundsUnderMotionThreshold = 0;
|
||||
private int m_crossingfailures = 0;
|
||||
private bool m_throttleUpdates;
|
||||
// private int throttleCounter;
|
||||
public int m_interpenetrationcount;
|
||||
public float m_collisionscore;
|
||||
public int m_roundsUnderMotionThreshold;
|
||||
private int m_crossingfailures;
|
||||
|
||||
public float m_buoyancy = 0f;
|
||||
public float m_buoyancy;
|
||||
|
||||
public bool outofBounds = false;
|
||||
public bool outofBounds;
|
||||
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
||||
|
||||
public bool _zeroFlag = false;
|
||||
private bool m_lastUpdateSent = false;
|
||||
public bool _zeroFlag;
|
||||
private bool m_lastUpdateSent;
|
||||
|
||||
|
||||
private String m_primName;
|
||||
private PhysicsVector _target_velocity;
|
||||
private Vector3 _target_velocity;
|
||||
|
||||
public int m_eventsubscription = 0;
|
||||
public int m_eventsubscription;
|
||||
// private CollisionEventUpdate CollisionEventsThisFrame = null;
|
||||
|
||||
public volatile bool childPrim = false;
|
||||
public volatile bool childPrim;
|
||||
|
||||
private btVector3 tempPosition1;
|
||||
private btVector3 tempPosition2;
|
||||
|
@ -190,7 +189,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
public btRigidBody Body;
|
||||
|
||||
public BulletDotNETPrim(String primName, BulletDotNETScene parent_scene, PhysicsVector pos, PhysicsVector size,
|
||||
public BulletDotNETPrim(String primName, BulletDotNETScene parent_scene, Vector3 pos, Vector3 size,
|
||||
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical)
|
||||
{
|
||||
tempPosition1 = new btVector3(0, 0, 0);
|
||||
|
@ -225,8 +224,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
AxisLockLinearHigh = new btVector3((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionSize);
|
||||
|
||||
_target_velocity = new PhysicsVector(0, 0, 0);
|
||||
_velocity = new PhysicsVector();
|
||||
_target_velocity = Vector3.Zero;
|
||||
_velocity = Vector3.Zero;
|
||||
_position = pos;
|
||||
m_taintposition = pos;
|
||||
PID_D = parent_scene.bodyPIDD;
|
||||
|
@ -244,8 +243,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
_size = size;
|
||||
m_taintsize = _size;
|
||||
_acceleration = new PhysicsVector();
|
||||
m_rotationalVelocity = PhysicsVector.Zero;
|
||||
_acceleration = Vector3.Zero;
|
||||
m_rotationalVelocity = Vector3.Zero;
|
||||
_orientation = rotation;
|
||||
m_taintrot = _orientation;
|
||||
_mesh = mesh;
|
||||
|
@ -274,7 +273,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
get { return _zeroFlag; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return _size; }
|
||||
set { _size = value; }
|
||||
|
@ -348,13 +347,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
m_taintparent = null;
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
|
||||
m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z);
|
||||
m_taintAngularLock = axis;
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
|
||||
|
@ -370,9 +369,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
get { return CalculateMass(); }
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
//get { return PhysicsVector.Zero; }
|
||||
//get { return Vector3.Zero; }
|
||||
get { return m_force; }
|
||||
set { m_force = value; }
|
||||
}
|
||||
|
@ -388,7 +387,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
//TODO:
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
|
@ -405,23 +404,23 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get
|
||||
{
|
||||
// Averate previous velocity with the new one so
|
||||
// client object interpolation works a 'little' better
|
||||
PhysicsVector returnVelocity = new PhysicsVector();
|
||||
Vector3 returnVelocity;
|
||||
returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2;
|
||||
returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2;
|
||||
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2;
|
||||
|
@ -436,12 +435,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!m_isphysical || Body.Handle == IntPtr.Zero)
|
||||
return new PhysicsVector(0, 0, 0);
|
||||
return Vector3.Zero;
|
||||
|
||||
return _torque;
|
||||
}
|
||||
|
@ -459,7 +458,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
set { m_collisionscore = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
@ -528,16 +527,16 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
||||
Vector3 pv = Vector3.Zero;
|
||||
if (_zeroFlag)
|
||||
return pv;
|
||||
m_lastUpdateSent = false;
|
||||
|
||||
if (m_rotationalVelocity.IsIdentical(pv, 0.2f))
|
||||
if (m_rotationalVelocity.ApproxEquals(pv, 0.2f))
|
||||
return pv;
|
||||
|
||||
return m_rotationalVelocity;
|
||||
|
@ -557,7 +556,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
set { m_buoyancy = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget { set { m_PIDTarget = value; ; } }
|
||||
public override Vector3 PIDTarget { set { m_PIDTarget = value; ; } }
|
||||
public override bool PIDActive { set { m_usePID = value; } }
|
||||
public override float PIDTau { set { m_PIDTau = value; } }
|
||||
|
||||
|
@ -567,20 +566,20 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
|
||||
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
m_forcelist.Add(force);
|
||||
m_taintforce = true;
|
||||
//m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
m_angularforcelist.Add(force);
|
||||
m_taintaddangularforce = true;
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -778,7 +777,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
}
|
||||
|
||||
if (!_position.IsIdentical(m_taintposition, 0f))
|
||||
if (!_position.ApproxEquals(m_taintposition, 0f))
|
||||
{
|
||||
m_log.Debug("[PHYSICS]: TaintMove");
|
||||
changemove(timestep);
|
||||
|
@ -796,7 +795,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
//
|
||||
|
||||
if (!_size.IsIdentical(m_taintsize, 0))
|
||||
if (!_size.ApproxEquals(m_taintsize, 0f))
|
||||
{
|
||||
m_log.Debug("[PHYSICS]: TaintSize");
|
||||
changesize(timestep);
|
||||
|
@ -820,7 +819,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
m_log.Debug("[PHYSICS]: TaintAngularForce");
|
||||
changeAddAngularForce(timestep);
|
||||
}
|
||||
if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f))
|
||||
if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
|
||||
{
|
||||
m_log.Debug("[PHYSICS]: TaintTorque");
|
||||
changeSetTorque(timestep);
|
||||
|
@ -835,7 +834,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
m_log.Debug("[PHYSICS]: TaintSelected");
|
||||
changeSelectedStatus(timestep);
|
||||
}
|
||||
if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f))
|
||||
if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
|
||||
{
|
||||
m_log.Debug("[PHYSICS]: TaintVelocity");
|
||||
changevelocity(timestep);
|
||||
|
@ -849,7 +848,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
{
|
||||
changefloatonwater(timestep);
|
||||
}
|
||||
if (!m_angularlock.IsIdentical(m_taintAngularLock, 0))
|
||||
if (!m_angularlock.ApproxEquals(m_taintAngularLock, 0))
|
||||
{
|
||||
m_log.Debug("[PHYSICS]: TaintAngularLock");
|
||||
changeAngularLock(timestep);
|
||||
|
@ -1012,7 +1011,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
{
|
||||
if (_parent_scene.needsMeshing(_pbs))
|
||||
{
|
||||
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity);
|
||||
ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity);
|
||||
// createmesh returns null when it doesn't mesh.
|
||||
CreateGeom(IntPtr.Zero, _mesh);
|
||||
}
|
||||
|
@ -1029,7 +1028,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
return _parent_scene.needsMeshing(_pbs);
|
||||
}
|
||||
|
||||
internal void ProcessGeomCreationAsTriMesh(PhysicsVector positionOffset, Quaternion orientation)
|
||||
internal void ProcessGeomCreationAsTriMesh(Vector3 positionOffset, Quaternion orientation)
|
||||
{
|
||||
// Don't need to re-enable body.. it's done in SetMesh
|
||||
float meshlod = _parent_scene.meshSculptLOD;
|
||||
|
@ -1038,7 +1037,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
meshlod = _parent_scene.MeshSculptphysicalLOD;
|
||||
|
||||
IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
|
||||
if (!positionOffset.IsIdentical(PhysicsVector.Zero, 0.001f) || orientation != Quaternion.Identity)
|
||||
if (!positionOffset.ApproxEquals(Vector3.Zero, 0.001f) || orientation != Quaternion.Identity)
|
||||
{
|
||||
|
||||
float[] xyz = new float[3];
|
||||
|
@ -1202,7 +1201,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||
if (IsPhysical)
|
||||
{
|
||||
PhysicsVector iforce = new PhysicsVector();
|
||||
Vector3 iforce = Vector3.Zero;
|
||||
for (int i = 0; i < m_forcelist.Count; i++)
|
||||
{
|
||||
iforce = iforce + m_forcelist[i];
|
||||
|
@ -1237,7 +1236,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||
if (IsPhysical)
|
||||
{
|
||||
PhysicsVector iforce = new PhysicsVector();
|
||||
Vector3 iforce = Vector3.Zero;
|
||||
for (int i = 0; i < m_angularforcelist.Count; i++)
|
||||
{
|
||||
iforce = iforce + m_angularforcelist[i];
|
||||
|
@ -1276,7 +1275,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
}
|
||||
}
|
||||
m_taintTorque = new PhysicsVector(0, 0, 0);
|
||||
m_taintTorque = Vector3.Zero;
|
||||
}
|
||||
|
||||
private void changedisable(float timestep)
|
||||
|
@ -1317,7 +1316,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
//resetCollisionAccounting();
|
||||
}
|
||||
m_taintVelocity = PhysicsVector.Zero;
|
||||
m_taintVelocity = Vector3.Zero;
|
||||
}
|
||||
|
||||
private void changelink(float timestep)
|
||||
|
@ -1361,7 +1360,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
if (m_taintparent != null)
|
||||
{
|
||||
m_taintparent.Position.Z = m_taintparent.Position.Z + 0.02f;
|
||||
Vector3 taintparentPosition = m_taintparent.Position;
|
||||
taintparentPosition.Z = m_taintparent.Position.Z + 0.02f;
|
||||
m_taintparent.Position = taintparentPosition;
|
||||
_parent_scene.AddPhysicsActorTaint(m_taintparent);
|
||||
}
|
||||
}
|
||||
|
@ -1382,7 +1383,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
{
|
||||
if (_parent == null)
|
||||
{
|
||||
if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f, 1f, 1f), 0))
|
||||
if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f))
|
||||
{
|
||||
//d.BodySetFiniteRotationMode(Body, 0);
|
||||
//d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
|
||||
|
@ -1395,7 +1396,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
|
||||
}
|
||||
m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z);
|
||||
m_angularlock = m_taintAngularLock;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
@ -1460,17 +1461,17 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
// TODO: NEED btVector3 for Linear Velocity
|
||||
// NEED btVector3 for Position
|
||||
|
||||
PhysicsVector pos = new PhysicsVector(_position.X, _position.Y, _position.Z); //TODO: Insert values gotten from bullet
|
||||
PhysicsVector vel = new PhysicsVector(_velocity.X, _velocity.Y, _velocity.Z);
|
||||
Vector3 pos = _position; //TODO: Insert values gotten from bullet
|
||||
Vector3 vel = _velocity;
|
||||
|
||||
_target_velocity =
|
||||
new PhysicsVector(
|
||||
new Vector3(
|
||||
(m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
|
||||
(m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
|
||||
(m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
|
||||
);
|
||||
|
||||
if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f))
|
||||
if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
|
||||
{
|
||||
|
||||
/* TODO: Do Bullet equiv
|
||||
|
@ -1512,8 +1513,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
{
|
||||
PID_G = m_PIDTau + 1;
|
||||
}
|
||||
PhysicsVector pos = new PhysicsVector(0, 0, 0); //TODO: Insert values gotten from bullet
|
||||
PhysicsVector vel = new PhysicsVector(0, 0, 0);
|
||||
Vector3 pos = Vector3.Zero; //TODO: Insert values gotten from bullet
|
||||
Vector3 vel = Vector3.Zero;
|
||||
|
||||
// determine what our target height really is based on HoverType
|
||||
switch (m_PIDHoverType)
|
||||
|
@ -1545,13 +1546,13 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
|
||||
_target_velocity =
|
||||
new PhysicsVector(0.0f, 0.0f,
|
||||
new Vector3(0.0f, 0.0f,
|
||||
(m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
|
||||
);
|
||||
|
||||
// if velocity is zero, use position control; otherwise, velocity control
|
||||
|
||||
if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f))
|
||||
if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
|
||||
{
|
||||
|
||||
/* TODO: Do Bullet Equiv
|
||||
|
@ -1626,8 +1627,8 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
else
|
||||
{
|
||||
if (m_zeroPosition == null)
|
||||
m_zeroPosition = new PhysicsVector(0, 0, 0);
|
||||
m_zeroPosition.setValues(_position.X, _position.Y, _position.Z);
|
||||
m_zeroPosition = Vector3.Zero;
|
||||
m_zeroPosition = _position;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2177,7 +2178,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
//if (hasTrimesh)
|
||||
//{
|
||||
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity);
|
||||
ProcessGeomCreationAsTriMesh(Vector3.Zero, Quaternion.Identity);
|
||||
// createmesh returns null when it doesn't mesh.
|
||||
|
||||
/*
|
||||
|
@ -2197,11 +2198,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
{
|
||||
if (chld == null)
|
||||
continue;
|
||||
PhysicsVector offset = chld.Position - Position;
|
||||
Vector3 offset = chld.Position - Position;
|
||||
Vector3 pos = new Vector3(offset.X, offset.Y, offset.Z);
|
||||
pos *= Quaternion.Inverse(Orientation);
|
||||
//pos *= Orientation;
|
||||
offset.setValues(pos.X, pos.Y, pos.Z);
|
||||
offset = pos;
|
||||
chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation);
|
||||
|
||||
_mesh.Append(chld._mesh);
|
||||
|
@ -2433,7 +2434,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
m_collisionscore = 0;
|
||||
m_disabled = false;
|
||||
// The body doesn't already have a finite rotation mode set here
|
||||
if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
|
||||
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||
{
|
||||
// TODO: Create Angular Motor on Axis Lock!
|
||||
}
|
||||
|
@ -2447,7 +2448,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
{
|
||||
if (_parent == null)
|
||||
{
|
||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
||||
Vector3 pv = Vector3.Zero;
|
||||
bool lastZeroFlag = _zeroFlag;
|
||||
if (tempPosition3 != null && tempPosition3.Handle != IntPtr.Zero)
|
||||
tempPosition3.Dispose();
|
||||
|
@ -2471,10 +2472,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
tempAngularVelocity1 = Body.getInterpolationAngularVelocity(); //rotvel
|
||||
tempLinearVelocity1 = Body.getInterpolationLinearVelocity(); // vel
|
||||
|
||||
_torque.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(),
|
||||
_torque = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getX(),
|
||||
tempAngularVelocity1.getZ());
|
||||
PhysicsVector l_position = new PhysicsVector();
|
||||
Quaternion l_orientation = new Quaternion();
|
||||
Vector3 l_position = Vector3.Zero;
|
||||
Quaternion l_orientation = Quaternion.Identity;
|
||||
m_lastposition = _position;
|
||||
m_lastorientation = _orientation;
|
||||
|
||||
|
@ -2598,20 +2599,18 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
_velocity.Z = tempLinearVelocity1.getZ();
|
||||
|
||||
_acceleration = ((_velocity - m_lastVelocity) / 0.1f);
|
||||
_acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f,
|
||||
_acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f,
|
||||
_velocity.Y - m_lastVelocity.Y / 0.1f,
|
||||
_velocity.Z - m_lastVelocity.Z / 0.1f);
|
||||
//m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
|
||||
|
||||
if (_velocity.IsIdentical(pv, 0.5f))
|
||||
if (_velocity.ApproxEquals(pv, 0.5f))
|
||||
{
|
||||
m_rotationalVelocity = pv;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
m_rotationalVelocity.setValues(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(),
|
||||
tempAngularVelocity1.getZ());
|
||||
m_rotationalVelocity = new Vector3(tempAngularVelocity1.getX(), tempAngularVelocity1.getY(), tempAngularVelocity1.getZ());
|
||||
}
|
||||
|
||||
//m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
|
||||
|
@ -2665,7 +2664,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
m_taintremove = true;
|
||||
}
|
||||
|
||||
internal void EnableAxisMotor(PhysicsVector axislock)
|
||||
internal void EnableAxisMotor(Vector3 axislock)
|
||||
{
|
||||
if (m_aMotor != null)
|
||||
DisableAxisMotor();
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
{
|
||||
BulletDotNETCharacter chr = new BulletDotNETCharacter(avName, this, position, size, avPIDD, avPIDP,
|
||||
avCapRadius, avStandupTensor, avDensity,
|
||||
|
@ -177,14 +177,14 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
}
|
||||
}
|
||||
|
||||
private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
|
||||
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
|
||||
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
|
||||
{
|
||||
PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
|
||||
Vector3 pos = position;
|
||||
//pos.X = position.X;
|
||||
//pos.Y = position.Y;
|
||||
//pos.Z = position.Z;
|
||||
PhysicsVector siz = new PhysicsVector();
|
||||
Vector3 siz = Vector3.Zero;
|
||||
siz.X = size.X;
|
||||
siz.Y = size.Y;
|
||||
siz.Z = size.Z;
|
||||
|
@ -201,12 +201,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
|
|||
return newPrim;
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation)
|
||||
{
|
||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, PhysicsVector size, Quaternion rotation, bool isPhysical)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, Vector3 size, Quaternion rotation, bool isPhysical)
|
||||
{
|
||||
PhysicsActor result;
|
||||
IMesh mesh = null;
|
||||
|
|
|
@ -52,14 +52,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
//Vector3
|
||||
public static Vector3 PhysicsVectorToXnaVector3(PhysicsVector physicsVector)
|
||||
public static Vector3 PhysicsVectorToXnaVector3(OpenMetaverse.Vector3 physicsVector)
|
||||
{
|
||||
return new Vector3(physicsVector.X, physicsVector.Y, physicsVector.Z);
|
||||
}
|
||||
|
||||
public static PhysicsVector XnaVector3ToPhysicsVector(Vector3 xnaVector3)
|
||||
public static OpenMetaverse.Vector3 XnaVector3ToPhysicsVector(Vector3 xnaVector3)
|
||||
{
|
||||
return new PhysicsVector(xnaVector3.X, xnaVector3.Y, xnaVector3.Z);
|
||||
return new OpenMetaverse.Vector3(xnaVector3.X, xnaVector3.Y, xnaVector3.Z);
|
||||
}
|
||||
|
||||
//Quaternion
|
||||
|
@ -349,7 +349,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
vertexBase = new Vector3[iVertexCount];
|
||||
for (int i = 0; i < iVertexCount; i++)
|
||||
{
|
||||
PhysicsVector v = mesh.getVertexList()[i];
|
||||
OpenMetaverse.Vector3 v = mesh.getVertexList()[i];
|
||||
if (v != null) // Note, null has special meaning. See meshing code for details
|
||||
vertexBase[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
||||
else
|
||||
|
@ -392,7 +392,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
private int preCheckCollision(BulletXActor actA, Vector3 vNormal, float fDist)
|
||||
{
|
||||
float fstartSide;
|
||||
PhysicsVector v = actA.Position;
|
||||
OpenMetaverse.Vector3 v = actA.Position;
|
||||
Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
||||
|
||||
fstartSide = Vector3.Dot(vNormal, v3) - fDist;
|
||||
|
@ -404,7 +404,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
{
|
||||
Vector3 perPlaneNormal;
|
||||
float fPerPlaneDist;
|
||||
PhysicsVector v = actA.Position;
|
||||
OpenMetaverse.Vector3 v = actA.Position;
|
||||
Vector3 v3 = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
||||
//check AB
|
||||
Vector3 v1;
|
||||
|
@ -573,9 +573,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
||||
public override PhysicsActor AddAvatar(string avName, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, bool isFlying)
|
||||
{
|
||||
PhysicsVector pos = new PhysicsVector();
|
||||
OpenMetaverse.Vector3 pos = OpenMetaverse.Vector3.Zero;
|
||||
pos.X = position.X;
|
||||
pos.Y = position.Y;
|
||||
pos.Z = position.Z + 20;
|
||||
|
@ -611,14 +611,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, OpenMetaverse.Quaternion rotation)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
|
||||
OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation)
|
||||
{
|
||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, OpenMetaverse.Quaternion rotation, bool isPhysical)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
|
||||
OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, bool isPhysical)
|
||||
{
|
||||
PhysicsActor result;
|
||||
|
||||
|
@ -645,7 +645,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
return result;
|
||||
}
|
||||
|
||||
public PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, OpenMetaverse.Quaternion rotation,
|
||||
public PhysicsActor AddPrim(String name, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation,
|
||||
IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
|
||||
{
|
||||
BulletXPrim newPrim = null;
|
||||
|
@ -879,12 +879,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
{
|
||||
protected bool flying = false;
|
||||
protected bool _physical = false;
|
||||
protected PhysicsVector _position;
|
||||
protected PhysicsVector _velocity;
|
||||
protected PhysicsVector _size;
|
||||
protected PhysicsVector _acceleration;
|
||||
protected OpenMetaverse.Vector3 _position;
|
||||
protected OpenMetaverse.Vector3 _velocity;
|
||||
protected OpenMetaverse.Vector3 _size;
|
||||
protected OpenMetaverse.Vector3 _acceleration;
|
||||
protected OpenMetaverse.Quaternion _orientation;
|
||||
protected PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
||||
protected OpenMetaverse.Vector3 m_rotationalVelocity;
|
||||
protected RigidBody rigidBody;
|
||||
protected int m_PhysicsActorType;
|
||||
private Boolean iscolliding = false;
|
||||
|
@ -900,7 +900,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override OpenMetaverse.Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
set
|
||||
|
@ -913,13 +913,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override OpenMetaverse.Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override OpenMetaverse.Vector3 Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
set
|
||||
|
@ -934,7 +934,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
}
|
||||
else
|
||||
{
|
||||
_velocity = new PhysicsVector();
|
||||
_velocity = OpenMetaverse.Vector3.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -944,7 +944,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
get { return 0f; }
|
||||
set { }
|
||||
}
|
||||
public override PhysicsVector Size
|
||||
public override OpenMetaverse.Vector3 Size
|
||||
{
|
||||
get { return _size; }
|
||||
set
|
||||
|
@ -956,9 +956,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override OpenMetaverse.Vector3 Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return OpenMetaverse.Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, OpenMetaverse.Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -988,14 +988,14 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override OpenMetaverse.Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return OpenMetaverse.Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override OpenMetaverse.Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return OpenMetaverse.Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShape Shape
|
||||
|
@ -1009,7 +1009,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override OpenMetaverse.Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(OpenMetaverse.Vector3 axis)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public virtual void SetAcceleration(PhysicsVector accel)
|
||||
public virtual void SetAcceleration(OpenMetaverse.Vector3 accel)
|
||||
{
|
||||
lock (BulletXScene.BulletXLock)
|
||||
{
|
||||
|
@ -1143,19 +1143,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
set { }
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
public override PhysicsVector Torque
|
||||
public override OpenMetaverse.Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return OpenMetaverse.Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(OpenMetaverse.Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(OpenMetaverse.Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1174,7 +1174,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
Translate(_position);
|
||||
}
|
||||
|
||||
protected internal void Translate(PhysicsVector _newPos)
|
||||
protected internal void Translate(OpenMetaverse.Vector3 _newPos)
|
||||
{
|
||||
Vector3 _translation;
|
||||
_translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition;
|
||||
|
@ -1186,7 +1186,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
Speed(_velocity);
|
||||
}
|
||||
|
||||
protected internal void Speed(PhysicsVector _newSpeed)
|
||||
protected internal void Speed(OpenMetaverse.Vector3 _newSpeed)
|
||||
{
|
||||
Vector3 _speed;
|
||||
_speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed);
|
||||
|
@ -1212,7 +1212,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
ReSize(_size);
|
||||
}
|
||||
|
||||
protected internal virtual void ReSize(PhysicsVector _newSize)
|
||||
protected internal virtual void ReSize(OpenMetaverse.Vector3 _newSize)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1227,7 +1227,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
{
|
||||
|
||||
}
|
||||
public override PhysicsVector PIDTarget { set { return; } }
|
||||
public override OpenMetaverse.Vector3 PIDTarget { set { return; } }
|
||||
public override bool PIDActive { set { return; } }
|
||||
public override float PIDTau { set { return; } }
|
||||
|
||||
|
@ -1256,19 +1256,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
/// </summary>
|
||||
public class BulletXCharacter : BulletXActor
|
||||
{
|
||||
public BulletXCharacter(BulletXScene parent_scene, PhysicsVector pos)
|
||||
public BulletXCharacter(BulletXScene parent_scene, OpenMetaverse.Vector3 pos)
|
||||
: this(String.Empty, parent_scene, pos)
|
||||
{
|
||||
}
|
||||
|
||||
public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos)
|
||||
: this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(),
|
||||
public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos)
|
||||
: this(avName, parent_scene, pos, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero, OpenMetaverse.Vector3.Zero,
|
||||
OpenMetaverse.Quaternion.Identity)
|
||||
{
|
||||
}
|
||||
|
||||
public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
|
||||
PhysicsVector size, PhysicsVector acceleration, OpenMetaverse.Quaternion orientation)
|
||||
public BulletXCharacter(String avName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity,
|
||||
OpenMetaverse.Vector3 size, OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion orientation)
|
||||
: base(avName)
|
||||
{
|
||||
//This fields will be removed. They're temporal
|
||||
|
@ -1323,25 +1323,25 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override OpenMetaverse.Vector3 Position
|
||||
{
|
||||
get { return base.Position; }
|
||||
set { base.Position = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override OpenMetaverse.Vector3 Velocity
|
||||
{
|
||||
get { return base.Velocity; }
|
||||
set { base.Velocity = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override OpenMetaverse.Vector3 Size
|
||||
{
|
||||
get { return base.Size; }
|
||||
set { base.Size = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override OpenMetaverse.Vector3 Acceleration
|
||||
{
|
||||
get { return base.Acceleration; }
|
||||
}
|
||||
|
@ -1370,17 +1370,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
set { base.Kinematic = value; }
|
||||
}
|
||||
|
||||
public override void SetAcceleration(PhysicsVector accel)
|
||||
public override void SetAcceleration(OpenMetaverse.Vector3 accel)
|
||||
{
|
||||
base.SetAcceleration(accel);
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
|
||||
{
|
||||
base.AddForce(force, pushforce);
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(OpenMetaverse.Vector3 momentum)
|
||||
{
|
||||
base.SetMomentum(momentum);
|
||||
}
|
||||
|
@ -1430,7 +1430,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
m.Translation = v3;
|
||||
rigidBody.WorldTransform = m;
|
||||
//When an Avie touch the ground it's vertical velocity it's reduced to ZERO
|
||||
Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
|
||||
Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1452,7 +1452,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
//For now all prims have the same density, all prims are made of water. Be water my friend! :D
|
||||
private const float _density = 1000.0f;
|
||||
private BulletXScene _parent_scene;
|
||||
private PhysicsVector m_prev_position = new PhysicsVector(0, 0, 0);
|
||||
private OpenMetaverse.Vector3 m_prev_position;
|
||||
private bool m_lastUpdateSent = false;
|
||||
//added by jed zhu
|
||||
private IMesh _mesh;
|
||||
|
@ -1460,17 +1460,17 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
|
||||
|
||||
|
||||
public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size,
|
||||
public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 size,
|
||||
OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
|
||||
: this(
|
||||
primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs,
|
||||
primName, parent_scene, pos, OpenMetaverse.Vector3.Zero, size, OpenMetaverse.Vector3.Zero, rotation, mesh, pbs,
|
||||
isPhysical)
|
||||
{
|
||||
}
|
||||
|
||||
public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
|
||||
PhysicsVector size,
|
||||
PhysicsVector acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs,
|
||||
public BulletXPrim(String primName, BulletXScene parent_scene, OpenMetaverse.Vector3 pos, OpenMetaverse.Vector3 velocity,
|
||||
OpenMetaverse.Vector3 size,
|
||||
OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs,
|
||||
bool isPhysical)
|
||||
: base(primName)
|
||||
{
|
||||
|
@ -1481,7 +1481,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
|
||||
_position = pos;
|
||||
_physical = isPhysical;
|
||||
_velocity = _physical ? velocity : new PhysicsVector();
|
||||
_velocity = _physical ? velocity : OpenMetaverse.Vector3.Zero;
|
||||
_size = size;
|
||||
_acceleration = acceleration;
|
||||
_orientation = rotation;
|
||||
|
@ -1497,19 +1497,19 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override OpenMetaverse.Vector3 Position
|
||||
{
|
||||
get { return base.Position; }
|
||||
set { base.Position = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override OpenMetaverse.Vector3 Velocity
|
||||
{
|
||||
get { return base.Velocity; }
|
||||
set { base.Velocity = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override OpenMetaverse.Vector3 Size
|
||||
{
|
||||
get { return _size; }
|
||||
set
|
||||
|
@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override OpenMetaverse.Vector3 Acceleration
|
||||
{
|
||||
get { return base.Acceleration; }
|
||||
}
|
||||
|
@ -1583,7 +1583,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
set { base.Kinematic = value; }
|
||||
}
|
||||
|
||||
public override void SetAcceleration(PhysicsVector accel)
|
||||
public override void SetAcceleration(OpenMetaverse.Vector3 accel)
|
||||
{
|
||||
lock (BulletXScene.BulletXLock)
|
||||
{
|
||||
|
@ -1591,12 +1591,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(OpenMetaverse.Vector3 force, bool pushforce)
|
||||
{
|
||||
base.AddForce(force,pushforce);
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(OpenMetaverse.Vector3 momentum)
|
||||
{
|
||||
base.SetMomentum(momentum);
|
||||
}
|
||||
|
@ -1613,7 +1613,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
//When a Prim touch the ground it's vertical velocity it's reduced to ZERO
|
||||
//Static objects don't have linear velocity
|
||||
if (_physical)
|
||||
Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
|
||||
Speed(new OpenMetaverse.Vector3(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1632,7 +1632,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
{
|
||||
if (!m_lastUpdateSent)
|
||||
{
|
||||
_velocity = new PhysicsVector(0, 0, 0);
|
||||
_velocity = OpenMetaverse.Vector3.Zero;
|
||||
base.ScheduleTerseUpdate();
|
||||
m_lastUpdateSent = true;
|
||||
}
|
||||
|
@ -1654,8 +1654,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
|
||||
#region Methods for updating values of RigidBody
|
||||
|
||||
protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, PhysicsVector pos,
|
||||
PhysicsVector size)
|
||||
protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, OpenMetaverse.Vector3 pos,
|
||||
OpenMetaverse.Vector3 size)
|
||||
{
|
||||
//For RigidBody Constructor. The next values might change
|
||||
float _linearDamping = 0.0f;
|
||||
|
@ -1683,7 +1683,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
Vector3[] v3Vertices = new Vector3[iVertexCount];
|
||||
for (int i = 0; i < iVertexCount; i++)
|
||||
{
|
||||
PhysicsVector v = mesh.getVertexList()[i];
|
||||
OpenMetaverse.Vector3 v = mesh.getVertexList()[i];
|
||||
if (v != null) // Note, null has special meaning. See meshing code for details
|
||||
v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
|
||||
else
|
||||
|
@ -1709,7 +1709,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
}
|
||||
}
|
||||
|
||||
protected internal void ReCreateRigidBody(PhysicsVector size)
|
||||
protected internal void ReCreateRigidBody(OpenMetaverse.Vector3 size)
|
||||
{
|
||||
//There is a bug when trying to remove a rigidBody that is colliding with something..
|
||||
try
|
||||
|
@ -1729,7 +1729,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
GC.Collect();
|
||||
}
|
||||
|
||||
protected internal override void ReSize(PhysicsVector _newSize)
|
||||
protected internal override void ReSize(OpenMetaverse.Vector3 _newSize)
|
||||
{
|
||||
//I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't
|
||||
//so i have to do it manually. That's recreating rigidbody
|
||||
|
@ -1744,8 +1744,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
/// </summary>
|
||||
internal class BulletXPlanet
|
||||
{
|
||||
private PhysicsVector _staticPosition;
|
||||
// private PhysicsVector _staticVelocity;
|
||||
private OpenMetaverse.Vector3 _staticPosition;
|
||||
// private Vector3 _staticVelocity;
|
||||
// private OpenMetaverse.Quaternion _staticOrientation;
|
||||
private float _mass;
|
||||
// private BulletXScene _parentscene;
|
||||
|
@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
|||
|
||||
internal BulletXPlanet(BulletXScene parent_scene, float[] heightField)
|
||||
{
|
||||
_staticPosition = new PhysicsVector(BulletXScene.MaxXY/2, BulletXScene.MaxXY/2, 0);
|
||||
_staticPosition = new OpenMetaverse.Vector3(BulletXScene.MaxXY / 2, BulletXScene.MaxXY / 2, 0);
|
||||
// _staticVelocity = new PhysicsVector();
|
||||
// _staticOrientation = OpenMetaverse.Quaternion.Identity;
|
||||
_mass = 0; //No active
|
||||
|
|
|
@ -28,13 +28,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
public interface IMesher
|
||||
{
|
||||
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod);
|
||||
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical);
|
||||
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod);
|
||||
IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical);
|
||||
}
|
||||
|
||||
public interface IVertex
|
||||
|
@ -43,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public interface IMesh
|
||||
{
|
||||
List<PhysicsVector> getVertexList();
|
||||
List<Vector3> getVertexList();
|
||||
int[] getIndexListAsInt();
|
||||
int[] getIndexListAsIntLocked();
|
||||
float[] getVertexListAsFloatLocked();
|
||||
|
|
|
@ -32,8 +32,8 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
public delegate void PositionUpdate(PhysicsVector position);
|
||||
public delegate void VelocityUpdate(PhysicsVector velocity);
|
||||
public delegate void PositionUpdate(Vector3 position);
|
||||
public delegate void VelocityUpdate(Vector3 velocity);
|
||||
public delegate void OrientationUpdate(Quaternion orientation);
|
||||
|
||||
public enum ActorTypes : int
|
||||
|
@ -106,7 +106,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
{
|
||||
public delegate void RequestTerseUpdate();
|
||||
public delegate void CollisionUpdate(EventArgs e);
|
||||
public delegate void OutOfBounds(PhysicsVector pos);
|
||||
public delegate void OutOfBounds(Vector3 pos);
|
||||
|
||||
// disable warning: public events
|
||||
#pragma warning disable 67
|
||||
|
@ -125,7 +125,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public abstract bool Stopped { get; }
|
||||
|
||||
public abstract PhysicsVector Size { get; set; }
|
||||
public abstract Vector3 Size { get; set; }
|
||||
|
||||
public abstract PrimitiveBaseShape Shape { set; }
|
||||
|
||||
|
@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public abstract void delink();
|
||||
|
||||
public abstract void LockAngularMotion(PhysicsVector axis);
|
||||
public abstract void LockAngularMotion(Vector3 axis);
|
||||
|
||||
public virtual void RequestPhysicsterseUpdate()
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
}
|
||||
}
|
||||
|
||||
public virtual void RaiseOutOfBounds(PhysicsVector pos)
|
||||
public virtual void RaiseOutOfBounds(Vector3 pos)
|
||||
{
|
||||
// Make a temporary copy of the event to avoid possibility of
|
||||
// a race condition if the last subscriber unsubscribes
|
||||
|
@ -187,23 +187,23 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
}
|
||||
|
||||
public abstract PhysicsVector Position { get; set; }
|
||||
public abstract Vector3 Position { get; set; }
|
||||
public abstract float Mass { get; }
|
||||
public abstract PhysicsVector Force { get; set; }
|
||||
public abstract Vector3 Force { get; set; }
|
||||
|
||||
public abstract int VehicleType { get; set; }
|
||||
public abstract void VehicleFloatParam(int param, float value);
|
||||
public abstract void VehicleVectorParam(int param, PhysicsVector value);
|
||||
public abstract void VehicleVectorParam(int param, Vector3 value);
|
||||
public abstract void VehicleRotationParam(int param, Quaternion rotation);
|
||||
|
||||
public abstract void SetVolumeDetect(int param); // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
|
||||
|
||||
public abstract PhysicsVector GeometricCenter { get; }
|
||||
public abstract PhysicsVector CenterOfMass { get; }
|
||||
public abstract PhysicsVector Velocity { get; set; }
|
||||
public abstract PhysicsVector Torque { get; set; }
|
||||
public abstract Vector3 GeometricCenter { get; }
|
||||
public abstract Vector3 CenterOfMass { get; }
|
||||
public abstract Vector3 Velocity { get; set; }
|
||||
public abstract Vector3 Torque { get; set; }
|
||||
public abstract float CollisionScore { get; set;}
|
||||
public abstract PhysicsVector Acceleration { get; }
|
||||
public abstract Vector3 Acceleration { get; }
|
||||
public abstract Quaternion Orientation { get; set; }
|
||||
public abstract int PhysicsActorType { get; set; }
|
||||
public abstract bool IsPhysical { get; set; }
|
||||
|
@ -214,12 +214,12 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public abstract bool CollidingGround { get; set; }
|
||||
public abstract bool CollidingObj { get; set; }
|
||||
public abstract bool FloatOnWater { set; }
|
||||
public abstract PhysicsVector RotationalVelocity { get; set; }
|
||||
public abstract Vector3 RotationalVelocity { get; set; }
|
||||
public abstract bool Kinematic { get; set; }
|
||||
public abstract float Buoyancy { get; set; }
|
||||
|
||||
// Used for MoveTo
|
||||
public abstract PhysicsVector PIDTarget { set;}
|
||||
public abstract Vector3 PIDTarget { set; }
|
||||
public abstract bool PIDActive { set;}
|
||||
public abstract float PIDTau { set; }
|
||||
|
||||
|
@ -231,9 +231,9 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public abstract float PIDHoverTau { set;}
|
||||
|
||||
|
||||
public abstract void AddForce(PhysicsVector force, bool pushforce);
|
||||
public abstract void AddAngularForce(PhysicsVector force, bool pushforce);
|
||||
public abstract void SetMomentum(PhysicsVector momentum);
|
||||
public abstract void AddForce(Vector3 force, bool pushforce);
|
||||
public abstract void AddAngularForce(Vector3 force, bool pushforce);
|
||||
public abstract void SetMomentum(Vector3 momentum);
|
||||
public abstract void SubscribeEvents(int ms);
|
||||
public abstract void UnSubscribeEvents();
|
||||
public abstract bool SubscribedEvents();
|
||||
|
@ -246,9 +246,9 @@ namespace OpenSim.Region.Physics.Manager
|
|||
get{ return false; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -296,9 +296,9 @@ namespace OpenSim.Region.Physics.Manager
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -307,9 +307,9 @@ namespace OpenSim.Region.Physics.Manager
|
|||
get { return 0f; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -344,14 +344,14 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShape Shape
|
||||
|
@ -359,15 +359,15 @@ namespace OpenSim.Region.Physics.Manager
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -387,9 +387,9 @@ namespace OpenSim.Region.Physics.Manager
|
|||
set { }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override bool IsPhysical
|
||||
|
@ -436,26 +436,26 @@ namespace OpenSim.Region.Physics.Manager
|
|||
{
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget { set { return; } }
|
||||
public override Vector3 PIDTarget { set { return; } }
|
||||
public override bool PIDActive { set { return; } }
|
||||
public override float PIDTau { set { return; } }
|
||||
|
||||
|
@ -464,7 +464,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public override PIDHoverType PIDHoverType { set { return; } }
|
||||
public override float PIDHoverTau { set { return; } }
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public PhysicsJointType Type;
|
||||
public string RawParams;
|
||||
public List<string> BodyNames = new List<string>();
|
||||
public PhysicsVector Position; // global coords
|
||||
public Vector3 Position; // global coords
|
||||
public Quaternion Rotation; // global coords
|
||||
public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
|
||||
public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName)
|
||||
|
|
|
@ -64,23 +64,23 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
|
||||
|
||||
public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying);
|
||||
public abstract PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying);
|
||||
|
||||
public abstract void RemoveAvatar(PhysicsActor actor);
|
||||
|
||||
public abstract void RemovePrim(PhysicsActor prim);
|
||||
|
||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation); //To be removed
|
||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation, bool isPhysical);
|
||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation); //To be removed
|
||||
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation, bool isPhysical);
|
||||
|
||||
public virtual bool SupportsNINJAJoints
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position,
|
||||
public virtual PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
|
||||
Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
|
||||
{ return null; }
|
||||
|
||||
|
@ -129,11 +129,11 @@ namespace OpenSim.Region.Physics.Manager
|
|||
}
|
||||
}
|
||||
|
||||
public virtual PhysicsVector GetJointAnchor(PhysicsJoint joint)
|
||||
{ return null; }
|
||||
public virtual Vector3 GetJointAnchor(PhysicsJoint joint)
|
||||
{ return Vector3.Zero; }
|
||||
|
||||
public virtual PhysicsVector GetJointAxis(PhysicsJoint joint)
|
||||
{ return null; }
|
||||
public virtual Vector3 GetJointAxis(PhysicsJoint joint)
|
||||
{ return Vector3.Zero; }
|
||||
|
||||
|
||||
public abstract void AddPhysicsActorTaint(PhysicsActor prim);
|
||||
|
@ -212,7 +212,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
// Does nothing right now
|
||||
}
|
||||
|
||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
{
|
||||
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position);
|
||||
return PhysicsActor.Null;
|
||||
|
@ -231,21 +231,21 @@ namespace OpenSim.Region.Physics.Manager
|
|||
}
|
||||
|
||||
/*
|
||||
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
||||
public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||
{
|
||||
m_log.InfoFormat("NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||
return PhysicsActor.Null;
|
||||
}
|
||||
*/
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation) //To be removed
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation) //To be removed
|
||||
{
|
||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||
{
|
||||
m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddPrim({0},{1})", position, size);
|
||||
return PhysicsActor.Null;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Timers;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
|
@ -46,7 +47,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
{
|
||||
get { return new NullPhysicsSensor(); }
|
||||
}
|
||||
public abstract PhysicsVector Position {get; set;}
|
||||
public abstract Vector3 Position { get; set; }
|
||||
public abstract void TimerCallback (object obj, ElapsedEventArgs eea);
|
||||
public abstract float radianarc {get; set;}
|
||||
public abstract string targetname {get; set;}
|
||||
|
@ -58,9 +59,9 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public class NullPhysicsSensor : PhysicsSensor
|
||||
{
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
public override void TimerCallback(object obj, ElapsedEventArgs eea)
|
||||
|
|
|
@ -29,24 +29,24 @@ using System;
|
|||
|
||||
namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
public class PhysicsVector
|
||||
/*public class PhysicsVector
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
public float Z;
|
||||
|
||||
public PhysicsVector()
|
||||
public Vector3()
|
||||
{
|
||||
}
|
||||
|
||||
public PhysicsVector(float x, float y, float z)
|
||||
public Vector3(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public PhysicsVector(PhysicsVector pv) : this(pv.X, pv.Y, pv.Z)
|
||||
public Vector3(Vector3 pv) : this(pv.X, pv.Y, pv.Z)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -115,17 +115,17 @@ namespace OpenSim.Region.Physics.Manager
|
|||
}
|
||||
|
||||
// Operations
|
||||
public static PhysicsVector operator +(PhysicsVector a, PhysicsVector b)
|
||||
public static PhysicsVector operator +(Vector3 a, Vector3 b)
|
||||
{
|
||||
return new PhysicsVector(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
|
||||
}
|
||||
|
||||
public static PhysicsVector operator -(PhysicsVector a, PhysicsVector b)
|
||||
public static PhysicsVector operator -(Vector3 a, Vector3 b)
|
||||
{
|
||||
return new PhysicsVector(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
|
||||
}
|
||||
|
||||
public static PhysicsVector cross(PhysicsVector a, PhysicsVector b)
|
||||
public static PhysicsVector cross(Vector3 a, Vector3 b)
|
||||
{
|
||||
return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
return (float) Math.Sqrt(X*X + Y*Y + Z*Z);
|
||||
}
|
||||
|
||||
public static float GetDistanceTo(PhysicsVector a, PhysicsVector b)
|
||||
public static float GetDistanceTo(Vector3 a, Vector3 b)
|
||||
{
|
||||
float dx = a.X - b.X;
|
||||
float dy = a.Y - b.Y;
|
||||
|
@ -143,22 +143,22 @@ namespace OpenSim.Region.Physics.Manager
|
|||
return (float) Math.Sqrt(dx * dx + dy * dy + dz * dz);
|
||||
}
|
||||
|
||||
public static PhysicsVector operator /(PhysicsVector v, float f)
|
||||
public static PhysicsVector operator /(Vector3 v, float f)
|
||||
{
|
||||
return new PhysicsVector(v.X/f, v.Y/f, v.Z/f);
|
||||
}
|
||||
|
||||
public static PhysicsVector operator *(PhysicsVector v, float f)
|
||||
public static PhysicsVector operator *(Vector3 v, float f)
|
||||
{
|
||||
return new PhysicsVector(v.X*f, v.Y*f, v.Z*f);
|
||||
}
|
||||
|
||||
public static PhysicsVector operator *(float f, PhysicsVector v)
|
||||
public static PhysicsVector operator *(float f, Vector3 v)
|
||||
{
|
||||
return v*f;
|
||||
}
|
||||
|
||||
public static bool isFinite(PhysicsVector v)
|
||||
public static bool isFinite(Vector3 v)
|
||||
{
|
||||
if (v == null)
|
||||
return false;
|
||||
|
@ -172,7 +172,7 @@ namespace OpenSim.Region.Physics.Manager
|
|||
return true;
|
||||
}
|
||||
|
||||
public virtual bool IsIdentical(PhysicsVector v, float tolerance)
|
||||
public virtual bool IsIdentical(Vector3 v, float tolerance)
|
||||
{
|
||||
PhysicsVector diff = this - v;
|
||||
float d = diff.length();
|
||||
|
@ -182,5 +182,5 @@ namespace OpenSim.Region.Physics.Manager
|
|||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
|
||||
/*
|
||||
* This is the zero mesher.
|
||||
|
@ -60,12 +61,12 @@ namespace OpenSim.Region.Physics.Manager
|
|||
|
||||
public class ZeroMesher : IMesher
|
||||
{
|
||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
|
||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
|
||||
{
|
||||
return CreateMesh(primName, primShape, size, lod, false);
|
||||
}
|
||||
|
||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
|
||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
|
||||
{
|
||||
// Remove the reference to the encoded JPEG2000 data so it can be GCed
|
||||
primShape.SculptData = OpenMetaverse.Utils.EmptyBytes;
|
||||
|
|
|
@ -33,30 +33,52 @@ using OpenMetaverse;
|
|||
using OpenSim.Region.Physics.Manager;
|
||||
using OpenSim.Region.Physics.Meshing;
|
||||
|
||||
public class Vertex : PhysicsVector, IComparable<Vertex>
|
||||
public class Vertex : IComparable<Vertex>
|
||||
{
|
||||
public Vertex(float x, float y, float z)
|
||||
: base(x, y, z)
|
||||
Vector3 vector;
|
||||
|
||||
public float X
|
||||
{
|
||||
get { return vector.X; }
|
||||
set { vector.X = value; }
|
||||
}
|
||||
|
||||
public float Y
|
||||
{
|
||||
get { return vector.Y; }
|
||||
set { vector.Y = value; }
|
||||
}
|
||||
|
||||
public float Z
|
||||
{
|
||||
get { return vector.Z; }
|
||||
set { vector.Z = value; }
|
||||
}
|
||||
|
||||
public Vertex(float x, float y, float z)
|
||||
{
|
||||
vector.X = x;
|
||||
vector.Y = y;
|
||||
vector.Z = z;
|
||||
}
|
||||
|
||||
public Vertex normalize()
|
||||
{
|
||||
float tlength = length();
|
||||
if (tlength != 0)
|
||||
float tlength = vector.Length();
|
||||
if (tlength != 0f)
|
||||
{
|
||||
float mul = 1.0f / tlength;
|
||||
return new Vertex(X * mul, Y * mul, Z * mul);
|
||||
return new Vertex(vector.X * mul, vector.Y * mul, vector.Z * mul);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Vertex(0, 0, 0);
|
||||
return new Vertex(0f, 0f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public Vertex cross(Vertex v)
|
||||
{
|
||||
return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X);
|
||||
return new Vertex(vector.Y * v.Z - vector.Z * v.Y, vector.Z * v.X - vector.X * v.Z, vector.X * v.Y - vector.Y * v.X);
|
||||
}
|
||||
|
||||
// disable warning: mono compiler moans about overloading
|
||||
|
@ -160,9 +182,9 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
|
|||
return X * v.X + Y * v.Y + Z * v.Z;
|
||||
}
|
||||
|
||||
public Vertex(PhysicsVector v)
|
||||
: base(v.X, v.Y, v.Z)
|
||||
public Vertex(Vector3 v)
|
||||
{
|
||||
vector = v;
|
||||
}
|
||||
|
||||
public Vertex Clone()
|
||||
|
@ -175,11 +197,15 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
|
|||
return new Vertex((float) Math.Cos(angle), (float) Math.Sin(angle), 0.0f);
|
||||
}
|
||||
|
||||
public float Length()
|
||||
{
|
||||
return vector.Length();
|
||||
}
|
||||
|
||||
public virtual bool Equals(Vertex v, float tolerance)
|
||||
{
|
||||
PhysicsVector diff = this - v;
|
||||
float d = diff.length();
|
||||
Vertex diff = this - v;
|
||||
float d = diff.Length();
|
||||
if (d < tolerance)
|
||||
return true;
|
||||
|
||||
|
@ -369,22 +395,22 @@ public class Triangle
|
|||
return s1 + ";" + s2 + ";" + s3;
|
||||
}
|
||||
|
||||
public PhysicsVector getNormal()
|
||||
public Vector3 getNormal()
|
||||
{
|
||||
// Vertices
|
||||
|
||||
// Vectors for edges
|
||||
PhysicsVector e1;
|
||||
PhysicsVector e2;
|
||||
Vector3 e1;
|
||||
Vector3 e2;
|
||||
|
||||
e1 = new PhysicsVector(v1.X - v2.X, v1.Y - v2.Y, v1.Z - v2.Z);
|
||||
e2 = new PhysicsVector(v1.X - v3.X, v1.Y - v3.Y, v1.Z - v3.Z);
|
||||
e1 = new Vector3(v1.X - v2.X, v1.Y - v2.Y, v1.Z - v2.Z);
|
||||
e2 = new Vector3(v1.X - v3.X, v1.Y - v3.Y, v1.Z - v3.Z);
|
||||
|
||||
// Cross product for normal
|
||||
PhysicsVector n = PhysicsVector.cross(e1, e2);
|
||||
Vector3 n = Vector3.Cross(e1, e2);
|
||||
|
||||
// Length
|
||||
float l = n.length();
|
||||
float l = n.Length();
|
||||
|
||||
// Normalized "normal"
|
||||
n = n/l;
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.IO;
|
|||
using System.Runtime.InteropServices;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using PrimMesher;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Physics.Meshing
|
||||
{
|
||||
|
@ -141,12 +142,12 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
}
|
||||
}
|
||||
|
||||
public List<PhysicsVector> getVertexList()
|
||||
public List<Vector3> getVertexList()
|
||||
{
|
||||
List<PhysicsVector> result = new List<PhysicsVector>();
|
||||
List<Vector3> result = new List<Vector3>();
|
||||
foreach (Vertex v in m_vertices.Keys)
|
||||
{
|
||||
result.Add(v);
|
||||
result.Add(new Vector3(v.X, v.Y, v.Z));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,6 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
public class Meshmerizer : IMesher
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// Setting baseDir to a path will enable the dumping of raw files
|
||||
// raw files can be imported by blender so a visual inspection of the results can be done
|
||||
|
@ -160,7 +159,7 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
float minZ = float.MaxValue;
|
||||
float maxZ = float.MinValue;
|
||||
|
||||
foreach (Vertex v in meshIn.getVertexList())
|
||||
foreach (Vector3 v in meshIn.getVertexList())
|
||||
{
|
||||
if (v != null)
|
||||
{
|
||||
|
@ -185,7 +184,7 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
|
||||
}
|
||||
|
||||
private ulong GetMeshKey(PrimitiveBaseShape pbs, PhysicsVector size, float lod)
|
||||
private ulong GetMeshKey(PrimitiveBaseShape pbs, Vector3 size, float lod)
|
||||
{
|
||||
ulong hash = 5381;
|
||||
|
||||
|
@ -245,9 +244,9 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
hash = ((hash << 5) + hash) + (ulong)((byte)c);
|
||||
return ((hash << 5) + hash) + (ulong)(c >> 8);
|
||||
}
|
||||
|
||||
|
||||
private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
|
||||
|
||||
private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
|
||||
{
|
||||
PrimMesh primMesh;
|
||||
PrimMesher.SculptMesh sculptMesh;
|
||||
|
@ -289,9 +288,6 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
ManagedImage managedImage; // we never use this
|
||||
OpenJPEG.DecodeToImage(primShape.SculptData, out managedImage, out idata);
|
||||
|
||||
// Remove the reference to the encoded JPEG2000 data so it can be GCed
|
||||
primShape.SculptData = Utils.EmptyBytes;
|
||||
|
||||
if (cacheSculptMaps)
|
||||
{
|
||||
try { idata.Save(decodedSculptFileName, ImageFormat.MemoryBmp); }
|
||||
|
@ -315,8 +311,6 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
PrimMesher.SculptMesh.SculptType sculptType;
|
||||
switch ((OpenMetaverse.SculptType)primShape.SculptType)
|
||||
{
|
||||
|
@ -351,7 +345,6 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
coords = sculptMesh.coords;
|
||||
faces = sculptMesh.faces;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
float pathShearX = primShape.PathShearX < 128 ? (float)primShape.PathShearX * 0.01f : (float)(primShape.PathShearX - 256) * 0.01f;
|
||||
|
@ -466,6 +459,8 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
faces = primMesh.faces;
|
||||
}
|
||||
|
||||
// Remove the reference to any JPEG2000 sculpt data so it can be GCed
|
||||
primShape.SculptData = Utils.EmptyBytes;
|
||||
|
||||
int numCoords = coords.Count;
|
||||
int numFaces = faces.Count;
|
||||
|
@ -488,12 +483,12 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
return mesh;
|
||||
}
|
||||
|
||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod)
|
||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
|
||||
{
|
||||
return CreateMesh(primName, primShape, size, lod, false);
|
||||
}
|
||||
|
||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size, float lod, bool isPhysical)
|
||||
public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
|
||||
{
|
||||
Mesh mesh = null;
|
||||
ulong key = 0;
|
||||
|
|
|
@ -68,15 +68,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private PhysicsVector _position;
|
||||
private Vector3 _position;
|
||||
private d.Vector3 _zeroPosition;
|
||||
// private d.Matrix3 m_StandUpRotation;
|
||||
private bool _zeroFlag = false;
|
||||
private bool m_lastUpdateSent = false;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _target_velocity;
|
||||
private PhysicsVector _acceleration;
|
||||
private PhysicsVector m_rotationalVelocity;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 _target_velocity;
|
||||
private Vector3 _acceleration;
|
||||
private Vector3 m_rotationalVelocity;
|
||||
private float m_mass = 80f;
|
||||
public float m_density = 60f;
|
||||
private bool m_pidControllerActive = true;
|
||||
|
@ -99,7 +99,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
private bool m_hackSentFall = false;
|
||||
private bool m_hackSentFly = false;
|
||||
private int m_requestedUpdateFrequency = 0;
|
||||
private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0);
|
||||
private Vector3 m_taintPosition = Vector3.Zero;
|
||||
public uint m_localID = 0;
|
||||
public bool m_returnCollisions = false;
|
||||
// taints and their non-tainted counterparts
|
||||
|
@ -143,22 +143,17 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
public UUID m_uuid;
|
||||
public bool bad = false;
|
||||
|
||||
public OdeCharacter(String avName, OdeScene parent_scene, PhysicsVector pos, CollisionLocker dode, PhysicsVector size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
|
||||
public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor)
|
||||
{
|
||||
m_uuid = UUID.Random();
|
||||
|
||||
// ode = dode;
|
||||
_velocity = new PhysicsVector();
|
||||
_target_velocity = new PhysicsVector();
|
||||
|
||||
|
||||
if (PhysicsVector.isFinite(pos))
|
||||
if (pos.IsFinite())
|
||||
{
|
||||
if (pos.Z > 9999999)
|
||||
if (pos.Z > 9999999f)
|
||||
{
|
||||
pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
||||
}
|
||||
if (pos.Z < -90000)
|
||||
if (pos.Z < -90000f)
|
||||
{
|
||||
pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
||||
}
|
||||
|
@ -169,15 +164,13 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
else
|
||||
{
|
||||
_position = new PhysicsVector(((int)_parent_scene.WorldExtents.X * 0.5f), ((int)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128, 128) + 10);
|
||||
_position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
|
||||
m_taintPosition.X = _position.X;
|
||||
m_taintPosition.Y = _position.Y;
|
||||
m_taintPosition.Z = _position.Z;
|
||||
m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
|
||||
}
|
||||
|
||||
|
||||
_acceleration = new PhysicsVector();
|
||||
_parent_scene = parent_scene;
|
||||
|
||||
PID_D = pid_d;
|
||||
|
@ -189,7 +182,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
walkDivisor = walk_divisor;
|
||||
runDivisor = rundivisor;
|
||||
|
||||
|
||||
// m_StandUpRotation =
|
||||
// new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
|
||||
// 0.5f);
|
||||
|
@ -205,7 +197,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
m_isPhysical = false; // current status: no ODE information exists
|
||||
m_tainted_isPhysical = true; // new tainted status: need to create ODE information
|
||||
|
||||
|
||||
_parent_scene.AddPhysicsActorTaint(this);
|
||||
|
||||
m_name = avName;
|
||||
|
@ -412,20 +403,20 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// Not really a good choice unless you 'know' it's a good
|
||||
/// spot otherwise you're likely to orbit the avatar.
|
||||
/// </summary>
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
set
|
||||
{
|
||||
if (Body == IntPtr.Zero || Shell == IntPtr.Zero)
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
if (value.Z > 9999999)
|
||||
if (value.Z > 9999999f)
|
||||
{
|
||||
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
||||
}
|
||||
if (value.Z < -90000)
|
||||
if (value.Z < -90000f)
|
||||
{
|
||||
value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
|
||||
}
|
||||
|
@ -447,7 +438,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
|
@ -457,20 +448,20 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight
|
||||
/// and use it to offset landings properly
|
||||
/// </summary>
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
|
||||
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
||||
set
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
m_pidControllerActive = true;
|
||||
|
||||
PhysicsVector SetSize = value;
|
||||
Vector3 SetSize = value;
|
||||
m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f;
|
||||
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
|
||||
|
||||
Velocity = new PhysicsVector(0f, 0f, 0f);
|
||||
Velocity = Vector3.Zero;
|
||||
|
||||
_parent_scene.AddPhysicsActorTaint(this);
|
||||
}
|
||||
|
@ -481,7 +472,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
private void AlignAvatarTiltWithCurrentDirectionOfMovement(PhysicsVector movementVector)
|
||||
private void AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3 movementVector)
|
||||
{
|
||||
movementVector.Z = 0f;
|
||||
float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y));
|
||||
|
@ -643,7 +634,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
// (with -0..0 motor stops) falls into the terrain for reasons yet
|
||||
// to be comprehended in their entirety.
|
||||
#endregion
|
||||
AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(0,0,0));
|
||||
AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
|
||||
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
|
||||
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
|
||||
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
|
||||
|
@ -688,7 +679,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -716,9 +707,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
|
||||
// }
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); }
|
||||
get { return _target_velocity; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -733,7 +724,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -748,14 +739,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShape Shape
|
||||
|
@ -763,18 +754,18 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get {
|
||||
// There's a problem with PhysicsVector.Zero! Don't Use it Here!
|
||||
// There's a problem with Vector3.Zero! Don't Use it Here!
|
||||
if (_zeroFlag)
|
||||
return new PhysicsVector(0f, 0f, 0f);
|
||||
return Vector3.Zero;
|
||||
m_lastUpdateSent = false;
|
||||
return _velocity;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
m_pidControllerActive = true;
|
||||
_target_velocity = value;
|
||||
|
@ -786,9 +777,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -814,12 +805,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
||||
public void SetAcceleration(PhysicsVector accel)
|
||||
public void SetAcceleration(Vector3 accel)
|
||||
{
|
||||
m_pidControllerActive = true;
|
||||
_acceleration = accel;
|
||||
|
@ -830,9 +821,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// The PID controller takes this target velocity and tries to make it a reality
|
||||
/// </summary>
|
||||
/// <param name="force"></param>
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
if (PhysicsVector.isFinite(force))
|
||||
if (force.IsFinite())
|
||||
{
|
||||
if (pushforce)
|
||||
{
|
||||
|
@ -861,7 +852,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
//m_lastUpdateSent = false;
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -870,7 +861,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// After all of the forces add up with 'add force' we apply them with doForce
|
||||
/// </summary>
|
||||
/// <param name="force"></param>
|
||||
public void doForce(PhysicsVector force)
|
||||
public void doForce(Vector3 force)
|
||||
{
|
||||
if (!collidelock)
|
||||
{
|
||||
|
@ -881,7 +872,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -908,9 +899,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
//PidStatus = true;
|
||||
|
||||
d.Vector3 localpos = d.BodyGetPosition(Body);
|
||||
PhysicsVector localPos = new PhysicsVector(localpos.X, localpos.Y, localpos.Z);
|
||||
Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z);
|
||||
|
||||
if (!PhysicsVector.isFinite(localPos))
|
||||
if (!localPos.IsFinite())
|
||||
{
|
||||
|
||||
m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
|
||||
|
@ -946,7 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
return;
|
||||
}
|
||||
|
||||
PhysicsVector vec = new PhysicsVector();
|
||||
Vector3 vec = Vector3.Zero;
|
||||
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
||||
|
||||
float movementdivisor = 1f;
|
||||
|
@ -1059,12 +1050,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
// end add Kitto Flora
|
||||
}
|
||||
if (PhysicsVector.isFinite(vec))
|
||||
if (vec.IsFinite())
|
||||
{
|
||||
doForce(vec);
|
||||
if (!_zeroFlag)
|
||||
{
|
||||
AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(vec.X, vec.Y, vec.Z));
|
||||
AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1197,7 +1188,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget { set { return; } }
|
||||
public override Vector3 PIDTarget { set { return; } }
|
||||
public override bool PIDActive { set { return; } }
|
||||
public override float PIDTau { set { return; } }
|
||||
|
||||
|
@ -1311,7 +1302,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
d.GeomDestroy(Shell);
|
||||
AvatarGeomAndBodyCreation(_position.X, _position.Y,
|
||||
_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
|
||||
Velocity = new PhysicsVector(0f, 0f, 0f);
|
||||
Velocity = Vector3.Zero;
|
||||
|
||||
_parent_scene.geom_name_map[Shell] = m_name;
|
||||
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
|
||||
|
@ -1325,7 +1316,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
if (!m_taintPosition.IsIdentical(_position, 0.05f))
|
||||
if (!m_taintPosition.ApproxEquals(_position, 0.05f))
|
||||
{
|
||||
if (Body != IntPtr.Zero)
|
||||
{
|
||||
|
|
|
@ -232,7 +232,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
}//end ProcessFloatVehicleParam
|
||||
|
||||
internal void ProcessVectorVehicleParam(Vehicle pParam, PhysicsVector pValue)
|
||||
internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
|
||||
{
|
||||
switch (pParam)
|
||||
{
|
||||
|
|
|
@ -57,44 +57,43 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private PhysicsVector _position;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _torque = new PhysicsVector(0,0,0);
|
||||
private PhysicsVector m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
private PhysicsVector m_lastposition = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
private Vector3 _position;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 _torque;
|
||||
private Vector3 m_lastVelocity;
|
||||
private Vector3 m_lastposition;
|
||||
private Quaternion m_lastorientation = new Quaternion();
|
||||
private PhysicsVector m_rotationalVelocity;
|
||||
private PhysicsVector _size;
|
||||
private PhysicsVector _acceleration;
|
||||
private Vector3 m_rotationalVelocity;
|
||||
private Vector3 _size;
|
||||
private Vector3 _acceleration;
|
||||
// private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
|
||||
private Quaternion _orientation;
|
||||
private PhysicsVector m_taintposition;
|
||||
private PhysicsVector m_taintsize;
|
||||
private PhysicsVector m_taintVelocity = new PhysicsVector(0, 0, 0);
|
||||
private PhysicsVector m_taintTorque = new PhysicsVector(0, 0, 0);
|
||||
private Vector3 m_taintposition;
|
||||
private Vector3 m_taintsize;
|
||||
private Vector3 m_taintVelocity;
|
||||
private Vector3 m_taintTorque;
|
||||
private Quaternion m_taintrot;
|
||||
private PhysicsVector m_angularlock = new PhysicsVector(1f, 1f, 1f);
|
||||
private PhysicsVector m_taintAngularLock = new PhysicsVector(1f, 1f, 1f);
|
||||
private Vector3 m_angularlock = Vector3.One;
|
||||
private Vector3 m_taintAngularLock = Vector3.One;
|
||||
private IntPtr Amotor = IntPtr.Zero;
|
||||
|
||||
private PhysicsVector m_PIDTarget = new PhysicsVector(0, 0, 0);
|
||||
// private PhysicsVector m_taintPIDTarget = new PhysicsVector(0, 0, 0);
|
||||
private float m_PIDTau = 0f;
|
||||
private Vector3 m_PIDTarget;
|
||||
private float m_PIDTau;
|
||||
private float PID_D = 35f;
|
||||
private float PID_G = 25f;
|
||||
private bool m_usePID = false;
|
||||
private bool m_usePID;
|
||||
|
||||
// KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
|
||||
// and are for non-VEHICLES only.
|
||||
|
||||
private float m_PIDHoverHeight = 0f;
|
||||
private float m_PIDHoverTau = 0f;
|
||||
private bool m_useHoverPID = false;
|
||||
|
||||
private float m_PIDHoverHeight;
|
||||
private float m_PIDHoverTau;
|
||||
private bool m_useHoverPID;
|
||||
private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
|
||||
private float m_targetHoverHeight = 0f;
|
||||
private float m_groundHeight = 0f;
|
||||
private float m_waterHeight = 0f;
|
||||
private float m_buoyancy = 0f; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
|
||||
private float m_targetHoverHeight;
|
||||
private float m_groundHeight;
|
||||
private float m_waterHeight;
|
||||
private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
|
||||
|
||||
// private float m_tensor = 5f;
|
||||
private int body_autodisable_frames = 20;
|
||||
|
@ -105,11 +104,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
| CollisionCategories.Body
|
||||
| CollisionCategories.Character
|
||||
);
|
||||
private bool m_taintshape = false;
|
||||
private bool m_taintPhysics = false;
|
||||
private bool m_taintshape;
|
||||
private bool m_taintPhysics;
|
||||
private bool m_collidesLand = true;
|
||||
private bool m_collidesWater = false;
|
||||
public bool m_returnCollisions = false;
|
||||
private bool m_collidesWater;
|
||||
public bool m_returnCollisions;
|
||||
|
||||
// Default we're a Geometry
|
||||
private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
|
||||
|
@ -117,85 +116,83 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
// Default, Collide with Other Geometries, spaces and Bodies
|
||||
private CollisionCategories m_collisionFlags = m_default_collisionFlags;
|
||||
|
||||
public bool m_taintremove = false;
|
||||
public bool m_taintdisable = false;
|
||||
public bool m_disabled = false;
|
||||
public bool m_taintadd = false;
|
||||
public bool m_taintselected = false;
|
||||
public bool m_taintCollidesWater = false;
|
||||
public bool m_taintremove;
|
||||
public bool m_taintdisable;
|
||||
public bool m_disabled;
|
||||
public bool m_taintadd;
|
||||
public bool m_taintselected;
|
||||
public bool m_taintCollidesWater;
|
||||
|
||||
public uint m_localID = 0;
|
||||
public uint m_localID;
|
||||
|
||||
//public GCHandle gc;
|
||||
private CollisionLocker ode;
|
||||
|
||||
private bool m_taintforce = false;
|
||||
private bool m_taintaddangularforce = false;
|
||||
private PhysicsVector m_force = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
private List<PhysicsVector> m_forcelist = new List<PhysicsVector>();
|
||||
private List<PhysicsVector> m_angularforcelist = new List<PhysicsVector>();
|
||||
private Vector3 m_force;
|
||||
private List<Vector3> m_forcelist = new List<Vector3>();
|
||||
private List<Vector3> m_angularforcelist = new List<Vector3>();
|
||||
|
||||
private IMesh _mesh;
|
||||
private PrimitiveBaseShape _pbs;
|
||||
private OdeScene _parent_scene;
|
||||
public IntPtr m_targetSpace = (IntPtr) 0;
|
||||
public IntPtr m_targetSpace = IntPtr.Zero;
|
||||
public IntPtr prim_geom;
|
||||
public IntPtr prev_geom;
|
||||
public IntPtr _triMeshData;
|
||||
|
||||
private IntPtr _linkJointGroup = (IntPtr)0;
|
||||
private PhysicsActor _parent = null;
|
||||
private PhysicsActor m_taintparent = null;
|
||||
private IntPtr _linkJointGroup = IntPtr.Zero;
|
||||
private PhysicsActor _parent;
|
||||
private PhysicsActor m_taintparent;
|
||||
|
||||
private List<OdePrim> childrenPrim = new List<OdePrim>();
|
||||
|
||||
private bool iscolliding = false;
|
||||
private bool m_isphysical = false;
|
||||
private bool m_isSelected = false;
|
||||
private bool iscolliding;
|
||||
private bool m_isphysical;
|
||||
private bool m_isSelected;
|
||||
|
||||
internal bool m_isVolumeDetect = false; // If true, this prim only detects collisions but doesn't collide actively
|
||||
internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
|
||||
|
||||
private bool m_throttleUpdates = false;
|
||||
private int throttleCounter = 0;
|
||||
public int m_interpenetrationcount = 0;
|
||||
public float m_collisionscore = 0;
|
||||
public int m_roundsUnderMotionThreshold = 0;
|
||||
private int m_crossingfailures = 0;
|
||||
private bool m_throttleUpdates;
|
||||
private int throttleCounter;
|
||||
public int m_interpenetrationcount;
|
||||
public float m_collisionscore;
|
||||
public int m_roundsUnderMotionThreshold;
|
||||
private int m_crossingfailures;
|
||||
|
||||
public bool outofBounds = false;
|
||||
public bool outofBounds;
|
||||
private float m_density = 10.000006836f; // Aluminum g/cm3;
|
||||
|
||||
public bool _zeroFlag = false;
|
||||
private bool m_lastUpdateSent = false;
|
||||
public bool _zeroFlag;
|
||||
private bool m_lastUpdateSent;
|
||||
|
||||
public IntPtr Body = (IntPtr) 0;
|
||||
public IntPtr Body = IntPtr.Zero;
|
||||
public String m_primName;
|
||||
// private String m_primName;
|
||||
private PhysicsVector _target_velocity;
|
||||
private Vector3 _target_velocity;
|
||||
public d.Mass pMass;
|
||||
|
||||
public int m_eventsubscription = 0;
|
||||
private CollisionEventUpdate CollisionEventsThisFrame = null;
|
||||
public int m_eventsubscription;
|
||||
private CollisionEventUpdate CollisionEventsThisFrame;
|
||||
|
||||
private IntPtr m_linkJoint = (IntPtr)0;
|
||||
private IntPtr m_linkJoint = IntPtr.Zero;
|
||||
|
||||
public volatile bool childPrim = false;
|
||||
public volatile bool childPrim;
|
||||
|
||||
private ODEDynamics m_vehicle;
|
||||
|
||||
internal int m_material = (int)Material.Wood;
|
||||
|
||||
public OdePrim(String primName, OdeScene parent_scene, PhysicsVector pos, PhysicsVector size,
|
||||
public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
|
||||
Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
|
||||
{
|
||||
_target_velocity = new PhysicsVector(0, 0, 0);
|
||||
m_vehicle = new ODEDynamics();
|
||||
//gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
|
||||
ode = dode;
|
||||
_velocity = new PhysicsVector();
|
||||
if (!PhysicsVector.isFinite(pos))
|
||||
if (!pos.IsFinite())
|
||||
{
|
||||
pos = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f)) + 0.5f);
|
||||
pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f),
|
||||
parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f);
|
||||
m_log.Warn("[PHYSICS]: Got nonFinite Object create Position");
|
||||
}
|
||||
_position = pos;
|
||||
|
@ -210,9 +207,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
prim_geom = IntPtr.Zero;
|
||||
prev_geom = IntPtr.Zero;
|
||||
|
||||
if (!PhysicsVector.isFinite(pos))
|
||||
if (!pos.IsFinite())
|
||||
{
|
||||
size = new PhysicsVector(0.5f, 0.5f, 0.5f);
|
||||
size = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
m_log.Warn("[PHYSICS]: Got nonFinite Object create Size");
|
||||
}
|
||||
|
||||
|
@ -222,8 +219,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
_size = size;
|
||||
m_taintsize = _size;
|
||||
_acceleration = new PhysicsVector();
|
||||
m_rotationalVelocity = PhysicsVector.Zero;
|
||||
|
||||
if (!QuaternionIsFinite(rotation))
|
||||
{
|
||||
|
@ -388,7 +383,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
m_disabled = false;
|
||||
|
||||
// The body doesn't already have a finite rotation mode set here
|
||||
if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
|
||||
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0.0f)) && _parent == null)
|
||||
{
|
||||
createAMotor(m_angularlock);
|
||||
}
|
||||
|
@ -882,7 +877,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
if (prim_geom != IntPtr.Zero)
|
||||
{
|
||||
if (!_position.IsIdentical(m_taintposition,0f))
|
||||
if (!_position.ApproxEquals(m_taintposition, 0f))
|
||||
changemove(timestep);
|
||||
|
||||
if (m_taintrot != _orientation)
|
||||
|
@ -907,7 +902,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
changePhysicsStatus(timestep);
|
||||
//
|
||||
|
||||
if (!_size.IsIdentical(m_taintsize,0))
|
||||
if (!_size.ApproxEquals(m_taintsize,0f))
|
||||
changesize(timestep);
|
||||
//
|
||||
|
||||
|
@ -921,7 +916,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
if (m_taintaddangularforce)
|
||||
changeAddAngularForce(timestep);
|
||||
|
||||
if (!m_taintTorque.IsIdentical(PhysicsVector.Zero, 0.001f))
|
||||
if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
|
||||
changeSetTorque(timestep);
|
||||
|
||||
if (m_taintdisable)
|
||||
|
@ -930,7 +925,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
if (m_taintselected != m_isSelected)
|
||||
changeSelectedStatus(timestep);
|
||||
|
||||
if (!m_taintVelocity.IsIdentical(PhysicsVector.Zero, 0.001f))
|
||||
if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
|
||||
changevelocity(timestep);
|
||||
|
||||
if (m_taintparent != _parent)
|
||||
|
@ -939,7 +934,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
if (m_taintCollidesWater != m_collidesWater)
|
||||
changefloatonwater(timestep);
|
||||
|
||||
if (!m_angularlock.IsIdentical(m_taintAngularLock,0))
|
||||
if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
|
||||
changeAngularLock(timestep);
|
||||
|
||||
}
|
||||
|
@ -959,7 +954,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
//If we have a parent then we're not authorative here
|
||||
if (_parent == null)
|
||||
{
|
||||
if (!m_taintAngularLock.IsIdentical(new PhysicsVector(1f,1f,1f), 0))
|
||||
if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f))
|
||||
{
|
||||
//d.BodySetFiniteRotationMode(Body, 0);
|
||||
//d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z);
|
||||
|
@ -976,7 +971,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
// Store this for later in case we get turned into a separate body
|
||||
m_angularlock = new PhysicsVector(m_taintAngularLock.X, m_taintAngularLock.Y, m_taintAngularLock.Z);
|
||||
m_angularlock = m_taintAngularLock;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1120,7 +1115,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
prm.m_disabled = false;
|
||||
|
||||
// The body doesn't already have a finite rotation mode set here
|
||||
if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
|
||||
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||
{
|
||||
prm.createAMotor(m_angularlock);
|
||||
}
|
||||
|
@ -1163,7 +1158,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
m_disabled = false;
|
||||
|
||||
// The body doesn't already have a finite rotation mode set here
|
||||
if ((!m_angularlock.IsIdentical(PhysicsVector.Zero, 0)) && _parent == null)
|
||||
if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null)
|
||||
{
|
||||
createAMotor(m_angularlock);
|
||||
}
|
||||
|
@ -1347,7 +1342,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
m_taintshape = false;
|
||||
m_taintforce = false;
|
||||
m_taintdisable = false;
|
||||
m_taintVelocity = PhysicsVector.Zero;
|
||||
m_taintVelocity = Vector3.Zero;
|
||||
}
|
||||
|
||||
public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
|
||||
|
@ -1576,7 +1571,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
//Console.WriteLine("Move " + m_primName);
|
||||
if(!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009
|
||||
// NON-'VEHICLES' are dealt with here
|
||||
if (d.BodyIsEnabled(Body) && !m_angularlock.IsIdentical(PhysicsVector.Zero, 0.003f))
|
||||
if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f))
|
||||
{
|
||||
d.Vector3 avel2 = d.BodyGetAngularVel(Body);
|
||||
if (m_angularlock.X == 1)
|
||||
|
@ -1633,7 +1628,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
|
||||
d.Vector3 pos = d.BodyGetPosition(Body);
|
||||
_target_velocity =
|
||||
new PhysicsVector(
|
||||
new Vector3(
|
||||
(m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep),
|
||||
(m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep),
|
||||
(m_PIDTarget.Z - pos.Z) * ((PID_G - m_PIDTau) * timestep)
|
||||
|
@ -1641,7 +1636,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
|
||||
// if velocity is zero, use position control; otherwise, velocity control
|
||||
|
||||
if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f))
|
||||
if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f))
|
||||
{
|
||||
// keep track of where we stopped. No more slippin' & slidin'
|
||||
|
||||
|
@ -1726,13 +1721,13 @@ Console.WriteLine(" JointCreateFixed");
|
|||
|
||||
|
||||
_target_velocity =
|
||||
new PhysicsVector(0.0f, 0.0f,
|
||||
new Vector3(0.0f, 0.0f,
|
||||
(m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
|
||||
);
|
||||
|
||||
// if velocity is zero, use position control; otherwise, velocity control
|
||||
|
||||
if (_target_velocity.IsIdentical(PhysicsVector.Zero, 0.1f))
|
||||
if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
|
||||
{
|
||||
// keep track of where we stopped. No more slippin' & slidin'
|
||||
|
||||
|
@ -1821,7 +1816,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
d.BodySetQuaternion(Body, ref myrot);
|
||||
if (m_isphysical)
|
||||
{
|
||||
if (!m_angularlock.IsIdentical(new PhysicsVector(1, 1, 1), 0))
|
||||
if (!m_angularlock.ApproxEquals(Vector3.One, 0f))
|
||||
createAMotor(m_angularlock);
|
||||
}
|
||||
}
|
||||
|
@ -2130,7 +2125,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||
if (IsPhysical)
|
||||
{
|
||||
PhysicsVector iforce = new PhysicsVector();
|
||||
Vector3 iforce = Vector3.Zero;
|
||||
for (int i = 0; i < m_forcelist.Count; i++)
|
||||
{
|
||||
iforce = iforce + (m_forcelist[i] * 100);
|
||||
|
@ -2160,8 +2155,8 @@ Console.WriteLine(" JointCreateFixed");
|
|||
d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z);
|
||||
}
|
||||
}
|
||||
|
||||
m_taintTorque = new PhysicsVector(0, 0, 0);
|
||||
|
||||
m_taintTorque = Vector3.Zero;
|
||||
}
|
||||
|
||||
public void changeAddAngularForce(float timestamp)
|
||||
|
@ -2173,7 +2168,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
//m_log.Info("[PHYSICS]: dequeing forcelist");
|
||||
if (IsPhysical)
|
||||
{
|
||||
PhysicsVector iforce = new PhysicsVector();
|
||||
Vector3 iforce = Vector3.Zero;
|
||||
for (int i = 0; i < m_angularforcelist.Count; i++)
|
||||
{
|
||||
iforce = iforce + (m_angularforcelist[i] * 100);
|
||||
|
@ -2207,7 +2202,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
|
||||
//resetCollisionAccounting();
|
||||
}
|
||||
m_taintVelocity = PhysicsVector.Zero;
|
||||
m_taintVelocity = Vector3.Zero;
|
||||
}
|
||||
|
||||
public override bool IsPhysical
|
||||
|
@ -2216,7 +2211,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
set {
|
||||
m_isphysical = value;
|
||||
if (!m_isphysical) // Zero the remembered last velocity
|
||||
m_lastVelocity = new PhysicsVector(0.0f, 0.0f, 0.0f);
|
||||
m_lastVelocity = Vector3.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2261,7 +2256,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
get { return _zeroFlag; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
|
||||
|
@ -2270,12 +2265,12 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return _size; }
|
||||
set
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
_size = value;
|
||||
}
|
||||
|
@ -2291,13 +2286,13 @@ Console.WriteLine(" JointCreateFixed");
|
|||
get { return CalculateMass(); }
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
//get { return PhysicsVector.Zero; }
|
||||
//get { return Vector3.Zero; }
|
||||
get { return m_force; }
|
||||
set
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
m_force = value;
|
||||
}
|
||||
|
@ -2319,7 +2314,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
m_vehicle.ProcessFloatVehicleParam((Vehicle) param, value);
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
m_vehicle.ProcessVectorVehicleParam((Vehicle) param, value);
|
||||
}
|
||||
|
@ -2337,14 +2332,14 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShape Shape
|
||||
|
@ -2356,13 +2351,13 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get
|
||||
{
|
||||
// Averate previous velocity with the new one so
|
||||
// client object interpolation works a 'little' better
|
||||
PhysicsVector returnVelocity = new PhysicsVector();
|
||||
Vector3 returnVelocity = Vector3.Zero;
|
||||
returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2;
|
||||
returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2;
|
||||
returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2;
|
||||
|
@ -2370,7 +2365,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
set
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
_velocity = value;
|
||||
|
||||
|
@ -2385,19 +2380,19 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!m_isphysical || Body == IntPtr.Zero)
|
||||
return new PhysicsVector(0,0,0);
|
||||
return Vector3.Zero;
|
||||
|
||||
return _torque;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
m_taintTorque = value;
|
||||
_parent_scene.AddPhysicsActorTaint(this);
|
||||
|
@ -2449,20 +2444,20 @@ Console.WriteLine(" JointCreateFixed");
|
|||
return true;
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
||||
|
||||
public void SetAcceleration(PhysicsVector accel)
|
||||
public void SetAcceleration(Vector3 accel)
|
||||
{
|
||||
_acceleration = accel;
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
if (PhysicsVector.isFinite(force))
|
||||
if (force.IsFinite())
|
||||
{
|
||||
m_forcelist.Add(force);
|
||||
m_taintforce = true;
|
||||
|
@ -2474,9 +2469,9 @@ Console.WriteLine(" JointCreateFixed");
|
|||
//m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
if (PhysicsVector.isFinite(force))
|
||||
if (force.IsFinite())
|
||||
{
|
||||
m_angularforcelist.Add(force);
|
||||
m_taintaddangularforce = true;
|
||||
|
@ -2487,23 +2482,23 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
||||
Vector3 pv = Vector3.Zero;
|
||||
if (_zeroFlag)
|
||||
return pv;
|
||||
m_lastUpdateSent = false;
|
||||
|
||||
if (m_rotationalVelocity.IsIdentical(pv, 0.2f))
|
||||
if (m_rotationalVelocity.ApproxEquals(pv, 0.2f))
|
||||
return pv;
|
||||
|
||||
return m_rotationalVelocity;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
m_rotationalVelocity = value;
|
||||
}
|
||||
|
@ -2544,16 +2539,16 @@ Console.WriteLine(" JointCreateFixed");
|
|||
m_taintparent = null;
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
// reverse the zero/non zero values for ODE.
|
||||
if (PhysicsVector.isFinite(axis))
|
||||
if (axis.IsFinite())
|
||||
{
|
||||
axis.X = (axis.X > 0) ? 1f : 0f;
|
||||
axis.Y = (axis.Y > 0) ? 1f : 0f;
|
||||
axis.Z = (axis.Z > 0) ? 1f : 0f;
|
||||
m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
|
||||
m_taintAngularLock = new PhysicsVector(axis.X, axis.Y, axis.Z);
|
||||
m_taintAngularLock = axis;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2566,7 +2561,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
// no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
|
||||
if (_parent == null)
|
||||
{
|
||||
PhysicsVector pv = new PhysicsVector(0, 0, 0);
|
||||
Vector3 pv = Vector3.Zero;
|
||||
bool lastZeroFlag = _zeroFlag;
|
||||
if (Body != (IntPtr)0) // FIXME -> or if it is a joint
|
||||
{
|
||||
|
@ -2575,9 +2570,9 @@ Console.WriteLine(" JointCreateFixed");
|
|||
d.Vector3 vel = d.BodyGetLinearVel(Body);
|
||||
d.Vector3 rotvel = d.BodyGetAngularVel(Body);
|
||||
d.Vector3 torque = d.BodyGetTorque(Body);
|
||||
_torque.setValues(torque.X, torque.Y, torque.Z);
|
||||
PhysicsVector l_position = new PhysicsVector();
|
||||
Quaternion l_orientation = new Quaternion();
|
||||
_torque = new Vector3(torque.X, torque.Y, torque.Z);
|
||||
Vector3 l_position = Vector3.Zero;
|
||||
Quaternion l_orientation = Quaternion.Identity;
|
||||
|
||||
// kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
|
||||
//if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); }
|
||||
|
@ -2712,16 +2707,16 @@ Console.WriteLine(" JointCreateFixed");
|
|||
_velocity.Z = vel.Z;
|
||||
|
||||
_acceleration = ((_velocity - m_lastVelocity) / 0.1f);
|
||||
_acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f);
|
||||
_acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f);
|
||||
//m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString());
|
||||
|
||||
if (_velocity.IsIdentical(pv, 0.5f))
|
||||
if (_velocity.ApproxEquals(pv, 0.5f))
|
||||
{
|
||||
m_rotationalVelocity = pv;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z);
|
||||
m_rotationalVelocity = new Vector3(rotvel.X, rotvel.Y, rotvel.Z);
|
||||
}
|
||||
|
||||
//m_log.Debug("ODE: " + m_rotationalVelocity.ToString());
|
||||
|
@ -2769,15 +2764,15 @@ Console.WriteLine(" JointCreateFixed");
|
|||
}
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget
|
||||
public override Vector3 PIDTarget
|
||||
{
|
||||
set
|
||||
{
|
||||
if (PhysicsVector.isFinite(value))
|
||||
if (value.IsFinite())
|
||||
{
|
||||
m_PIDTarget = value;
|
||||
}
|
||||
|
@ -2793,7 +2788,7 @@ Console.WriteLine(" JointCreateFixed");
|
|||
public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } }
|
||||
public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
|
||||
|
||||
private void createAMotor(PhysicsVector axis)
|
||||
private void createAMotor(Vector3 axis)
|
||||
{
|
||||
if (Body == IntPtr.Zero)
|
||||
return;
|
||||
|
|
|
@ -684,7 +684,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns>Returns which split up space the given position is in.</returns>
|
||||
public string whichspaceamIin(PhysicsVector pos)
|
||||
public string whichspaceamIin(Vector3 pos)
|
||||
{
|
||||
return calculateSpaceForGeom(pos).ToString();
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
//p2.CollidingObj = true;
|
||||
contacts[i].depth = 0.00000003f;
|
||||
p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f);
|
||||
p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f);
|
||||
contacts[i].pos =
|
||||
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
|
||||
contacts[i].pos.Y + (p1.Size.Y/2),
|
||||
|
@ -981,7 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
//p2.CollidingObj = true;
|
||||
contacts[i].depth = 0.00000003f;
|
||||
p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f);
|
||||
p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f);
|
||||
contacts[i].pos =
|
||||
new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
|
||||
contacts[i].pos.Y + (p1.Size.Y/2),
|
||||
|
@ -1646,9 +1646,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
#region Add/Remove Entities
|
||||
|
||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
{
|
||||
PhysicsVector pos = new PhysicsVector();
|
||||
Vector3 pos;
|
||||
pos.X = position.X;
|
||||
pos.Y = position.Y;
|
||||
pos.Z = position.Z;
|
||||
|
@ -1698,18 +1698,12 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
|
||||
}
|
||||
|
||||
private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
|
||||
private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
|
||||
IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
|
||||
{
|
||||
|
||||
PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
|
||||
//pos.X = position.X;
|
||||
//pos.Y = position.Y;
|
||||
//pos.Z = position.Z;
|
||||
PhysicsVector siz = new PhysicsVector();
|
||||
siz.X = size.X;
|
||||
siz.Y = size.Y;
|
||||
siz.Z = size.Z;
|
||||
|
||||
Vector3 pos = position;
|
||||
Vector3 siz = size;
|
||||
Quaternion rot = rotation;
|
||||
|
||||
OdePrim newPrim;
|
||||
|
@ -1736,14 +1730,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation) //To be removed
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation) //To be removed
|
||||
{
|
||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||
{
|
||||
PhysicsActor result;
|
||||
IMesh mesh = null;
|
||||
|
@ -1976,7 +1970,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
// this joint will just be added to a waiting list that is NOT processed during the main
|
||||
// Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests.
|
||||
|
||||
public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position,
|
||||
public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
|
||||
Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
|
||||
|
||||
{
|
||||
|
@ -1984,7 +1978,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
OdePhysicsJoint joint = new OdePhysicsJoint();
|
||||
joint.ObjectNameInScene = objectNameInScene;
|
||||
joint.Type = jointType;
|
||||
joint.Position = new PhysicsVector(position.X, position.Y, position.Z);
|
||||
joint.Position = position;
|
||||
joint.Rotation = rotation;
|
||||
joint.RawParams = parms;
|
||||
joint.BodyNames = new List<string>(bodyNames);
|
||||
|
@ -2036,7 +2030,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
|
||||
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
|
||||
public override PhysicsVector GetJointAnchor(PhysicsJoint joint)
|
||||
public override Vector3 GetJointAnchor(PhysicsJoint joint)
|
||||
{
|
||||
Debug.Assert(joint.IsInPhysicsEngine);
|
||||
d.Vector3 pos = new d.Vector3();
|
||||
|
@ -2058,14 +2052,14 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
break;
|
||||
}
|
||||
}
|
||||
return new PhysicsVector(pos.X, pos.Y, pos.Z);
|
||||
return new Vector3(pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
|
||||
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
|
||||
// WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
|
||||
// appears to be unreliable. Fortunately we can compute the joint axis ourselves by
|
||||
// keeping track of the joint's original orientation relative to one of the involved bodies.
|
||||
public override PhysicsVector GetJointAxis(PhysicsJoint joint)
|
||||
public override Vector3 GetJointAxis(PhysicsJoint joint)
|
||||
{
|
||||
Debug.Assert(joint.IsInPhysicsEngine);
|
||||
d.Vector3 axis = new d.Vector3();
|
||||
|
@ -2087,7 +2081,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
break;
|
||||
}
|
||||
}
|
||||
return new PhysicsVector(axis.X, axis.Y, axis.Z);
|
||||
return new Vector3(axis.X, axis.Y, axis.Z);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2255,7 +2249,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// <param name="pos">the position that the geom moved to</param>
|
||||
/// <param name="currentspace">a pointer to the space it was in before it was moved.</param>
|
||||
/// <returns>a pointer to the new space it's in</returns>
|
||||
public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace)
|
||||
public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace)
|
||||
{
|
||||
// Called from setting the Position and Size of an ODEPrim so
|
||||
// it's already in locked space.
|
||||
|
@ -2402,7 +2396,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns>a pointer to the space. This could be a new space or reused space.</returns>
|
||||
public IntPtr calculateSpaceForGeom(PhysicsVector pos)
|
||||
public IntPtr calculateSpaceForGeom(Vector3 pos)
|
||||
{
|
||||
int[] xyspace = calculateSpaceArrayItemFromPos(pos);
|
||||
//m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString());
|
||||
|
@ -2414,7 +2408,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns>an array item based on the position</returns>
|
||||
public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos)
|
||||
public int[] calculateSpaceArrayItemFromPos(Vector3 pos)
|
||||
{
|
||||
int[] returnint = new int[2];
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
public void CreateAndDropPhysicalCube()
|
||||
{
|
||||
PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
|
||||
PhysicsVector position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
|
||||
PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f);
|
||||
Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
|
||||
Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
Quaternion rot = Quaternion.Identity;
|
||||
PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true);
|
||||
OdePrim oprim = (OdePrim)prim;
|
||||
|
|
|
@ -36,20 +36,17 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
{
|
||||
public class POSCharacter : PhysicsActor
|
||||
{
|
||||
private PhysicsVector _position;
|
||||
public PhysicsVector _velocity;
|
||||
public PhysicsVector _target_velocity = PhysicsVector.Zero;
|
||||
public PhysicsVector _size = PhysicsVector.Zero;
|
||||
private PhysicsVector _acceleration;
|
||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
||||
private Vector3 _position;
|
||||
public Vector3 _velocity;
|
||||
public Vector3 _target_velocity = Vector3.Zero;
|
||||
public Vector3 _size = Vector3.Zero;
|
||||
private Vector3 _acceleration;
|
||||
private Vector3 m_rotationalVelocity = Vector3.Zero;
|
||||
private bool flying;
|
||||
private bool isColliding;
|
||||
|
||||
public POSCharacter()
|
||||
{
|
||||
_velocity = new PhysicsVector();
|
||||
_position = new PhysicsVector();
|
||||
_acceleration = new PhysicsVector();
|
||||
}
|
||||
|
||||
public override int PhysicsActorType
|
||||
|
@ -58,7 +55,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
|
@ -137,13 +134,13 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
set { _position = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return _size; }
|
||||
set
|
||||
|
@ -158,9 +155,9 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
get { return 0f; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -190,14 +187,14 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShape Shape
|
||||
|
@ -205,15 +202,15 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
set { _target_velocity = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -229,7 +226,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
set { }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
@ -248,24 +245,24 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetAcceleration(PhysicsVector accel)
|
||||
public void SetAcceleration(Vector3 accel)
|
||||
{
|
||||
_acceleration = accel;
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -273,7 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget
|
||||
public override Vector3 PIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
|
|
@ -36,19 +36,16 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
{
|
||||
public class POSPrim : PhysicsActor
|
||||
{
|
||||
private PhysicsVector _position;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _acceleration;
|
||||
private PhysicsVector _size;
|
||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
||||
private Vector3 _position;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 _acceleration;
|
||||
private Vector3 _size;
|
||||
private Vector3 m_rotationalVelocity = Vector3.Zero;
|
||||
private Quaternion _orientation;
|
||||
private bool iscolliding;
|
||||
|
||||
public POSPrim()
|
||||
{
|
||||
_velocity = new PhysicsVector();
|
||||
_position = new PhysicsVector();
|
||||
_acceleration = new PhysicsVector();
|
||||
}
|
||||
|
||||
public override int PhysicsActorType
|
||||
|
@ -57,7 +54,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
|
@ -98,13 +95,13 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
set { _position = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return _size; }
|
||||
set { _size = value; }
|
||||
|
@ -115,9 +112,9 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
get { return 0f; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -132,7 +129,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -147,14 +144,14 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShape Shape
|
||||
|
@ -173,7 +170,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
set { _velocity = value; }
|
||||
|
@ -191,7 +188,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
set { _orientation = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
@ -202,26 +199,26 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
set { }
|
||||
}
|
||||
|
||||
public void SetAcceleration(PhysicsVector accel)
|
||||
public void SetAcceleration(Vector3 accel)
|
||||
{
|
||||
_acceleration = accel;
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -255,7 +252,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -268,7 +265,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget
|
||||
public override Vector3 PIDTarget
|
||||
{
|
||||
set { return; }
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
{
|
||||
POSCharacter act = new POSCharacter();
|
||||
act.Position = position;
|
||||
|
@ -84,20 +84,20 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
}
|
||||
|
||||
/*
|
||||
public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
||||
public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation)
|
||||
{
|
||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||
{
|
||||
POSPrim prim = new POSPrim();
|
||||
prim.Position = position;
|
||||
|
@ -152,23 +152,25 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
character._target_velocity.Z += gravity * timeStep;
|
||||
}
|
||||
|
||||
character.Position.X += character._target_velocity.X * timeStep;
|
||||
character.Position.Y += character._target_velocity.Y * timeStep;
|
||||
Vector3 characterPosition = character.Position;
|
||||
|
||||
character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
|
||||
character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
|
||||
characterPosition.X += character._target_velocity.X * timeStep;
|
||||
characterPosition.Y += character._target_velocity.Y * timeStep;
|
||||
|
||||
characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
|
||||
characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
|
||||
|
||||
bool forcedZ = false;
|
||||
|
||||
float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X];
|
||||
if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2)
|
||||
{
|
||||
character.Position.Z = terrainheight + character.Size.Z;
|
||||
characterPosition.Z = terrainheight + character.Size.Z;
|
||||
forcedZ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
character.Position.Z += character._target_velocity.Z*timeStep;
|
||||
characterPosition.Z += character._target_velocity.Z*timeStep;
|
||||
}
|
||||
|
||||
/// this is it -- the magic you've all been waiting for! Ladies and gentlemen --
|
||||
|
@ -177,29 +179,29 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
|
||||
if (isCollidingWithPrim(character))
|
||||
{
|
||||
character.Position.Z = oldposZ; // first try Z axis
|
||||
characterPosition.Z = oldposZ; // first try Z axis
|
||||
if (isCollidingWithPrim(character))
|
||||
{
|
||||
character.Position.Z = oldposZ + character.Size.Z / 4.4f; // try harder
|
||||
characterPosition.Z = oldposZ + character.Size.Z / 4.4f; // try harder
|
||||
if (isCollidingWithPrim(character))
|
||||
{
|
||||
character.Position.Z = oldposZ + character.Size.Z / 2.2f; // try very hard
|
||||
characterPosition.Z = oldposZ + character.Size.Z / 2.2f; // try very hard
|
||||
if (isCollidingWithPrim(character))
|
||||
{
|
||||
character.Position.X = oldposX;
|
||||
character.Position.Y = oldposY;
|
||||
character.Position.Z = oldposZ;
|
||||
characterPosition.X = oldposX;
|
||||
characterPosition.Y = oldposY;
|
||||
characterPosition.Z = oldposZ;
|
||||
|
||||
character.Position.X += character._target_velocity.X * timeStep;
|
||||
characterPosition.X += character._target_velocity.X * timeStep;
|
||||
if (isCollidingWithPrim(character))
|
||||
{
|
||||
character.Position.X = oldposX;
|
||||
characterPosition.X = oldposX;
|
||||
}
|
||||
|
||||
character.Position.Y += character._target_velocity.Y * timeStep;
|
||||
characterPosition.Y += character._target_velocity.Y * timeStep;
|
||||
if (isCollidingWithPrim(character))
|
||||
{
|
||||
character.Position.Y = oldposY;
|
||||
characterPosition.Y = oldposY;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -218,8 +220,10 @@ namespace OpenSim.Region.Physics.POSPlugin
|
|||
}
|
||||
}
|
||||
|
||||
character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
|
||||
character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
|
||||
characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
|
||||
characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
|
||||
|
||||
character.Position = characterPosition;
|
||||
|
||||
character._velocity.X = (character.Position.X - oldposX)/timeStep;
|
||||
character._velocity.Y = (character.Position.Y - oldposY)/timeStep;
|
||||
|
|
|
@ -34,6 +34,7 @@ using PhysXWrapper;
|
|||
using Quaternion=OpenMetaverse.Quaternion;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Region.Physics.PhysXPlugin
|
||||
{
|
||||
|
@ -106,7 +107,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying)
|
||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||
{
|
||||
Vec3 pos = new Vec3();
|
||||
pos.X = position.X;
|
||||
|
@ -127,7 +128,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
{
|
||||
}
|
||||
|
||||
private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
|
||||
private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
|
||||
{
|
||||
Vec3 pos = new Vec3();
|
||||
pos.X = position.X;
|
||||
|
@ -142,14 +143,14 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
return act;
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation) //To be removed
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation) //To be removed
|
||||
{
|
||||
return AddPrimShape(primName, pbs, position, size, rotation, false);
|
||||
}
|
||||
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
|
||||
PhysicsVector size, Quaternion rotation, bool isPhysical)
|
||||
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
|
||||
Vector3 size, Quaternion rotation, bool isPhysical)
|
||||
{
|
||||
return AddPrim(position, size, rotation);
|
||||
}
|
||||
|
@ -219,10 +220,10 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
public class PhysXCharacter : PhysicsActor
|
||||
{
|
||||
private PhysicsVector _position;
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero;
|
||||
private PhysicsVector _acceleration;
|
||||
private Vector3 _position;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 m_rotationalVelocity = Vector3.Zero;
|
||||
private Vector3 _acceleration;
|
||||
private NxCharacter _character;
|
||||
private bool flying;
|
||||
private bool iscolliding = false;
|
||||
|
@ -230,9 +231,6 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
public PhysXCharacter(NxCharacter character)
|
||||
{
|
||||
_velocity = new PhysicsVector();
|
||||
_position = new PhysicsVector();
|
||||
_acceleration = new PhysicsVector();
|
||||
_character = character;
|
||||
}
|
||||
|
||||
|
@ -310,7 +308,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
|
@ -321,7 +319,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get { return _position; }
|
||||
set
|
||||
|
@ -335,9 +333,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { }
|
||||
}
|
||||
|
||||
|
@ -346,9 +344,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
get { return 0f; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -363,7 +361,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -379,17 +377,17 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
}
|
||||
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
set { _velocity = value; }
|
||||
|
@ -413,25 +411,25 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
set { }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
||||
public void SetAcceleration(PhysicsVector accel)
|
||||
public void SetAcceleration(Vector3 accel)
|
||||
{
|
||||
_acceleration = accel;
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -445,12 +443,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -492,7 +490,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget { set { return; } }
|
||||
public override Vector3 PIDTarget { set { return; } }
|
||||
public override bool PIDActive { set { return; } }
|
||||
public override float PIDTau { set { return; } }
|
||||
|
||||
|
@ -518,15 +516,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
public class PhysXPrim : PhysicsActor
|
||||
{
|
||||
private PhysicsVector _velocity;
|
||||
private PhysicsVector _acceleration;
|
||||
private PhysicsVector m_rotationalVelocity;
|
||||
private Vector3 _velocity;
|
||||
private Vector3 _acceleration;
|
||||
private Vector3 m_rotationalVelocity;
|
||||
private NxActor _prim;
|
||||
|
||||
public PhysXPrim(NxActor prim)
|
||||
{
|
||||
_velocity = new PhysicsVector();
|
||||
_acceleration = new PhysicsVector();
|
||||
_velocity = Vector3.Zero;
|
||||
_acceleration = Vector3.Zero;
|
||||
_prim = prim;
|
||||
}
|
||||
|
||||
|
@ -580,7 +578,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector RotationalVelocity
|
||||
public override Vector3 RotationalVelocity
|
||||
{
|
||||
get { return m_rotationalVelocity; }
|
||||
set { m_rotationalVelocity = value; }
|
||||
|
@ -616,11 +614,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
get { return false; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Position
|
||||
public override Vector3 Position
|
||||
{
|
||||
get
|
||||
{
|
||||
PhysicsVector pos = new PhysicsVector();
|
||||
Vector3 pos = Vector3.Zero;
|
||||
Vec3 vec = _prim.Position;
|
||||
pos.X = vec.X;
|
||||
pos.Y = vec.Y;
|
||||
|
@ -629,7 +627,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
}
|
||||
set
|
||||
{
|
||||
PhysicsVector vec = value;
|
||||
Vector3 vec = value;
|
||||
Vec3 pos = new Vec3();
|
||||
pos.X = vec.X;
|
||||
pos.Y = vec.Y;
|
||||
|
@ -643,15 +641,15 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
set { return; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Velocity
|
||||
public override Vector3 Velocity
|
||||
{
|
||||
get { return _velocity; }
|
||||
set { _velocity = value; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Torque
|
||||
public override Vector3 Torque
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -682,31 +680,31 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
set { }
|
||||
}
|
||||
|
||||
public override PhysicsVector Acceleration
|
||||
public override Vector3 Acceleration
|
||||
{
|
||||
get { return _acceleration; }
|
||||
}
|
||||
|
||||
public void SetAcceleration(PhysicsVector accel)
|
||||
public void SetAcceleration(Vector3 accel)
|
||||
{
|
||||
_acceleration = accel;
|
||||
}
|
||||
|
||||
public override void AddForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddAngularForce(PhysicsVector force, bool pushforce)
|
||||
public override void AddAngularForce(Vector3 force, bool pushforce)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetMomentum(PhysicsVector momentum)
|
||||
public override void SetMomentum(Vector3 momentum)
|
||||
{
|
||||
}
|
||||
|
||||
public override PhysicsVector Size
|
||||
public override Vector3 Size
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { }
|
||||
}
|
||||
|
||||
|
@ -718,7 +716,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public override void LockAngularMotion(PhysicsVector axis)
|
||||
public override void LockAngularMotion(Vector3 axis)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -728,9 +726,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
get { return 0f; }
|
||||
}
|
||||
|
||||
public override PhysicsVector Force
|
||||
public override Vector3 Force
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
set { return; }
|
||||
}
|
||||
|
||||
|
@ -745,7 +743,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override void VehicleVectorParam(int param, PhysicsVector value)
|
||||
public override void VehicleVectorParam(int param, Vector3 value)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -760,21 +758,21 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
|||
|
||||
}
|
||||
|
||||
public override PhysicsVector CenterOfMass
|
||||
public override Vector3 CenterOfMass
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override PhysicsVector GeometricCenter
|
||||
public override Vector3 GeometricCenter
|
||||
{
|
||||
get { return PhysicsVector.Zero; }
|
||||
get { return Vector3.Zero; }
|
||||
}
|
||||
|
||||
public override void CrossingFailure()
|
||||
{
|
||||
}
|
||||
|
||||
public override PhysicsVector PIDTarget { set { return; } }
|
||||
public override Vector3 PIDTarget { set { return; } }
|
||||
public override bool PIDActive { set { return; } }
|
||||
public override float PIDTau { set { return; } }
|
||||
|
||||
|
|
|
@ -2047,7 +2047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (local != 0)
|
||||
force *= llGetRot();
|
||||
|
||||
m_host.ParentGroup.RootPart.SetForce(new PhysicsVector((float)force.x, (float)force.y, (float)force.z));
|
||||
m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2062,7 +2062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
if (!m_host.ParentGroup.IsDeleted)
|
||||
{
|
||||
PhysicsVector tmpForce = m_host.ParentGroup.RootPart.GetForce();
|
||||
Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
|
||||
force.x = tmpForce.X;
|
||||
force.y = tmpForce.Y;
|
||||
force.z = tmpForce.Z;
|
||||
|
@ -4180,7 +4180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
applied_linear_impulse *= m_host.GetWorldRotation();
|
||||
}
|
||||
pusheeav.PhysicsActor.AddForce(new PhysicsVector(applied_linear_impulse.X, applied_linear_impulse.Y, applied_linear_impulse.Z), true);
|
||||
pusheeav.PhysicsActor.AddForce(applied_linear_impulse, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6088,7 +6088,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (!m_host.ParentGroup.IsDeleted)
|
||||
{
|
||||
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
|
||||
new PhysicsVector((float)vec.x, (float)vec.y, (float)vec.z));
|
||||
new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue