From c261812e39a9a3543e0370ef725bde0553609c34 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 19 Nov 2007 04:46:05 +0000 Subject: [PATCH] added rotation support to POS --- OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 2e0f2e3624..e13cedd7f2 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs @@ -135,15 +135,19 @@ namespace OpenSim.Region.Physics.POSPlugin " absX: " + Math.Abs(p.Position.X - c.Position.X) + " sizeX: " + p.Size.X * 0.5 + 0.5); */ - if (Math.Abs(p.Position.X - c.Position.X) >= (p.Size.X * 0.5 + 0.5)) + + Vector3 rotatedPos = p.Orientation.Inverse() * new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y, c.Position.Z - p.Position.Z);; + Vector3 avatarSize = p.Orientation.Inverse() * new Vector3(c.Size.X, c.Size.Y, c.Size.Z); + + if (Math.Abs(rotatedPos.x) >= (p.Size.X * 0.5 + avatarSize.x)) { return false; } - if (Math.Abs(p.Position.Y - c.Position.Y) >= (p.Size.Y * 0.5 + 0.5)) + if (Math.Abs(rotatedPos.y) >= (p.Size.Y * 0.5 + avatarSize.y)) { return false; } - if (Math.Abs(p.Position.Z - c.Position.Z) >= (p.Size.Z * 0.5 + 1.0)) + if (Math.Abs(rotatedPos.z) >= (p.Size.Z * 0.5 + avatarSize.z)) { return false; } @@ -338,7 +342,7 @@ namespace OpenSim.Region.Physics.POSPlugin public override PhysicsVector Size { - get { return new PhysicsVector(0, 0, 0); } + get { return new PhysicsVector(0.5f, 0.5f, 1.0f); } set { } }