From d199767e6991d6f368661fce9c5a072e564b8a4b Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Sun, 25 Oct 2009 23:16:12 -0700
Subject: Experimental change of PhysicsVector to Vector3. Untested
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 +-
.../Region/Framework/Scenes/SceneObjectGroup.cs | 26 ++++++------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 46 +++++++++++-----------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++-----
4 files changed, 45 insertions(+), 49 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7eafef7..6c34056 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -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
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 34ada4c..38a0cff 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -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);
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a87bde0..70f3112 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -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) {
/// true for the local frame, false for the global frame
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) {
/// true for the local frame, false for the global frame
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) {
/// true for the local frame, false for the global frame
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);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0ac5be0..87fac0c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -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)
{
--
cgit v1.1