Merge branch 'tests' of kitto@tor.k-grid.com:/home/kitto/opensim into careminster

avinationmerge
Melanie 2009-12-10 18:17:29 +00:00
commit 59ca92b10b
5 changed files with 171 additions and 128 deletions

View File

@ -29,9 +29,8 @@ namespace OpenSim
{ {
public class VersionInfo public class VersionInfo
{ {
private const string VERSION_NUMBER = "0.6.9-CM"; private const string VERSION_NUMBER = "112609s";
private const Flavour VERSION_FLAVOUR = Flavour.Dev; private const Flavour VERSION_FLAVOUR = Flavour.BetaM7;
public enum Flavour public enum Flavour
{ {
Unknown, Unknown,
@ -39,7 +38,8 @@ namespace OpenSim
RC1, RC1,
RC2, RC2,
Release, Release,
Post_Fixes Post_Fixes,
BetaM7
} }
public static string Version public static string Version

View File

@ -331,12 +331,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{ {
//m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called");
m_log.Debug("---------------------------"); /* m_log.Debug("---------------------------");
m_log.Debug(" >> uri=" + request["uri"]); m_log.Debug(" >> uri=" + request["uri"]);
m_log.Debug(" >> content-type=" + request["content-type"]); m_log.Debug(" >> content-type=" + request["content-type"]);
m_log.Debug(" >> http-method=" + request["http-method"]); m_log.Debug(" >> http-method=" + request["http-method"]);
m_log.Debug("---------------------------\n"); m_log.Debug("---------------------------\n"); */
Hashtable responsedata = new Hashtable(); Hashtable responsedata = new Hashtable();
responsedata["content_type"] = "text/html"; responsedata["content_type"] = "text/html";
responsedata["keepalive"] = false; responsedata["keepalive"] = false;
@ -576,11 +575,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{ {
m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called"); m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called");
m_log.Debug("---------------------------"); /* m_log.Debug("---------------------------");
m_log.Debug(" >> uri=" + request["uri"]); m_log.Debug(" >> uri=" + request["uri"]);
m_log.Debug(" >> content-type=" + request["content-type"]); m_log.Debug(" >> content-type=" + request["content-type"]);
m_log.Debug(" >> http-method=" + request["http-method"]); m_log.Debug(" >> http-method=" + request["http-method"]);
m_log.Debug("---------------------------\n"); m_log.Debug("---------------------------\n"); */
Hashtable responsedata = new Hashtable(); Hashtable responsedata = new Hashtable();
responsedata["content_type"] = "text/html"; responsedata["content_type"] = "text/html";

View File

@ -212,6 +212,7 @@ namespace OpenSim.Region.Framework.Scenes
private Quaternion m_sitTargetOrientation = Quaternion.Identity; private Quaternion m_sitTargetOrientation = Quaternion.Identity;
private Vector3 m_sitTargetPosition; private Vector3 m_sitTargetPosition;
private string m_sitAnimation = "SIT"; private string m_sitAnimation = "SIT";
private bool m_occupied; // KF if any av is sitting on this prim
private string m_text = String.Empty; private string m_text = String.Empty;
private string m_touchName = String.Empty; private string m_touchName = String.Empty;
private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
@ -512,9 +513,16 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// If this is a linkset, we don't want the physics engine mucking up our group position here. // If this is a linkset, we don't want the physics engine mucking up our group position here.
PhysicsActor actor = PhysActor; PhysicsActor actor = PhysActor;
if (actor != null && _parentID == 0) if (actor != null)
{ {
m_groupPosition = actor.Position; if (_parentID == 0)
{
m_groupPosition = actor.Position;
}
else
{
m_groupPosition = ParentGroup.AbsolutePosition; // KF+Casper Update Child prims too!
}
} }
if (IsAttachment) if (IsAttachment)
@ -841,7 +849,8 @@ namespace OpenSim.Region.Framework.Scenes
if (IsAttachment) if (IsAttachment)
return GroupPosition; return GroupPosition;
return m_offsetPosition + m_groupPosition; } // return m_offsetPosition + m_groupPosition; }
return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
} }
public SceneObjectGroup ParentGroup public SceneObjectGroup ParentGroup
@ -993,6 +1002,13 @@ namespace OpenSim.Region.Framework.Scenes
get { return _flags; } get { return _flags; }
set { _flags = value; } set { _flags = value; }
} }
[XmlIgnore]
public bool IsOccupied // KF If an av is sittingon this prim
{
get { return m_occupied; }
set { m_occupied = value; }
}
[XmlIgnore] [XmlIgnore]
public UUID SitTargetAvatar public UUID SitTargetAvatar
@ -1735,9 +1751,13 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion parentRot = ParentGroup.RootPart.RotationOffset; Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
Vector3 axPos = OffsetPosition; Vector3 axPos = OffsetPosition;
axPos *= parentRot; axPos *= parentRot;
Vector3 translationOffsetPosition = axPos; Vector3 translationOffsetPosition = axPos;
int tx = (int)GroupPosition.X;
int ty = (int)GroupPosition.Y;
int tz = (int)GroupPosition.Z;
return GroupPosition + translationOffsetPosition; return GroupPosition + translationOffsetPosition;
} }

View File

@ -197,6 +197,7 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_autopilotMoving; private bool m_autopilotMoving;
private Vector3 m_autoPilotTarget; private Vector3 m_autoPilotTarget;
private bool m_sitAtAutoTarget; private bool m_sitAtAutoTarget;
private Vector3 m_initialSitTarget; //KF: First estimate of where to sit
private string m_nextSitAnimation = String.Empty; private string m_nextSitAnimation = String.Empty;
@ -1525,7 +1526,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sitAtAutoTarget = false; m_sitAtAutoTarget = false;
PrimitiveBaseShape proxy = PrimitiveBaseShape.Default; PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
//proxy.PCode = (byte)PCode.ParticleSystem; //proxy.PCode = (byte)PCode.ParticleSystem;
proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy); proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy);
proxyObjectGroup.AttachToScene(m_scene); proxyObjectGroup.AttachToScene(m_scene);
@ -1567,7 +1567,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_moveToPositionInProgress = true; m_moveToPositionInProgress = true;
m_moveToPositionTarget = new Vector3(locx, locy, locz); m_moveToPositionTarget = new Vector3(locx, locy, locz);
} }
catch (Exception ex) catch (Exception ex)
{ {
//Why did I get this error? //Why did I get this error?
@ -1643,20 +1643,24 @@ namespace OpenSim.Region.Framework.Scenes
// Reset sit target. // Reset sit target.
if (part.GetAvatarOnSitTarget() == UUID) if (part.GetAvatarOnSitTarget() == UUID)
part.SetAvatarOnSitTarget(UUID.Zero); part.SetAvatarOnSitTarget(UUID.Zero);
m_parentPosition = part.GetWorldPosition(); m_parentPosition = part.GetWorldPosition();
ControllingClient.SendClearFollowCamProperties(part.ParentUUID); ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
} }
// part.GetWorldRotation() is the rotation of the object being sat on
// Rotation is the sittiing Av's rotation
Quaternion wr = Quaternion.Inverse(Quaternion.Inverse(Rotation) * Quaternion.Inverse(part.GetWorldRotation())); // world or. of the av
Vector3 so = new Vector3(1.0f, 0f, 0f) * wr; // 1M infront of av
Vector3 wso = so + part.GetWorldPosition() + ( m_pos * part.GetWorldRotation()); // + av sit offset!
if (m_physicsActor == null) if (m_physicsActor == null)
{ {
AddToPhysicalScene(false); AddToPhysicalScene(false);
} }
m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); AbsolutePosition = wso; //KF: Fix stand up.
m_parentPosition = Vector3.Zero; m_parentPosition = Vector3.Zero;
//Console.WriteLine("Stand Pos {0}", m_pos); m_parentID = 0;
part.IsOccupied = false;
m_parentID = 0;
SendFullUpdateToAllClients(); SendFullUpdateToAllClients();
m_requestedSitTargetID = 0; m_requestedSitTargetID = 0;
if ((m_physicsActor != null) && (m_avHeight > 0)) if ((m_physicsActor != null) && (m_avHeight > 0))
@ -1695,13 +1699,9 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 avSitOffSet = part.SitTargetPosition; Vector3 avSitOffSet = part.SitTargetPosition;
Quaternion avSitOrientation = part.SitTargetOrientation; Quaternion avSitOrientation = part.SitTargetOrientation;
UUID avOnTargetAlready = part.GetAvatarOnSitTarget(); UUID avOnTargetAlready = part.GetAvatarOnSitTarget();
bool SitTargetOccupied = (avOnTargetAlready != UUID.Zero);
bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored.
bool SitTargetisSet = if (SitTargetisSet && !SitTargetOccupied)
(!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 1f &&
avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f));
// this test is probably failing
if (SitTargetisSet && SitTargetUnOccupied)
{ {
//switch the target to this prim //switch the target to this prim
return part; return part;
@ -1715,7 +1715,7 @@ namespace OpenSim.Region.Framework.Scenes
private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset) private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset)
{ {
bool autopilot = true; bool autopilot = true;
Vector3 pos = new Vector3(); Vector3 autopilotTarget = new Vector3();
Quaternion sitOrientation = Quaternion.Identity; Quaternion sitOrientation = Quaternion.Identity;
Vector3 cameraEyeOffset = Vector3.Zero; Vector3 cameraEyeOffset = Vector3.Zero;
Vector3 cameraAtOffset = Vector3.Zero; Vector3 cameraAtOffset = Vector3.Zero;
@ -1723,101 +1723,104 @@ namespace OpenSim.Region.Framework.Scenes
//SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
SceneObjectPart part = FindNextAvailableSitTarget(targetID); SceneObjectPart part = FindNextAvailableSitTarget(targetID);
if (part != null) if (part == null) return;
{
// TODO: determine position to sit at based on scene geometry; don't trust offset from client // TODO: determine position to sit at based on scene geometry; don't trust offset from client
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
// part is the prim to sit on // part is the prim to sit on
// offset is the vector distance from that prim center to the click-spot // offset is the world-ref vector distance from that prim center to the click-spot
// UUID is the UUID of the Avatar doing the clicking // UUID is the UUID of the Avatar doing the clicking
m_avInitialPos = AbsolutePosition; // saved to calculate unscripted sit rotation m_avInitialPos = AbsolutePosition; // saved to calculate unscripted sit rotation
// Is a sit target available? // Is a sit target available?
Vector3 avSitOffSet = part.SitTargetPosition; Vector3 avSitOffSet = part.SitTargetPosition;
Quaternion avSitOrientation = part.SitTargetOrientation; Quaternion avSitOrientation = part.SitTargetOrientation;
UUID avOnTargetAlready = part.GetAvatarOnSitTarget();
bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored.
bool SitTargetisSet = Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
(!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f &&
( //Console.WriteLine("SendSitResponse offset=" + offset + " Occup=" + part.IsOccupied + " TargSet=" + SitTargetisSet);
avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 1f // Valid Zero Rotation quaternion // Sit analysis rewritten by KF 091125
|| avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point if (SitTargetisSet) // scipted sit
|| avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion {
) if (!part.IsOccupied)
)); {
//Console.WriteLine("Scripted, unoccupied");
//Console.WriteLine("SendSitResponse offset=" + offset + " UnOccup=" + SitTargetUnOccupied + part.SetAvatarOnSitTarget(UUID); // set that Av will be on it
// " TargSet=" + SitTargetisSet); offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one
// Sit analysis rewritten by KF 091125 sitOrientation = avSitOrientation; // Change rotatione to the scripted one
if (SitTargetisSet) // scipted sit autopilot = false; // Jump direct to scripted llSitPos()
{
if (SitTargetUnOccupied)
{
part.SetAvatarOnSitTarget(UUID); // set that Av will be on it
offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one
sitOrientation = avSitOrientation; // Change rotatione to the scripted one
autopilot = false; // Jump direct to scripted llSitPos()
}
else return;
} }
else // Not Scripted else
{ {
if ( (Math.Abs(offset.X) > 0.5f) || (Math.Abs(offset.Y) > 0.5f) ) // large prim //Console.WriteLine("Scripted, occupied");
{ return;
Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); }
m_avUnscriptedSitPos = offset * partIRot; // sit where clicked }
pos = part.AbsolutePosition + (offset * partIRot); else // Not Scripted
} {
else // small prim if ( (Math.Abs(offset.X) > 0.5f) || (Math.Abs(offset.Y) > 0.5f) )
{ {
if (SitTargetUnOccupied) // large prim & offset, ignore if other Avs sitting
{ // offset.Z -= 0.05f;
m_avUnscriptedSitPos = Vector3.Zero; // Sit on unoccupied small prim center m_avUnscriptedSitPos = offset * partIRot; // (non-zero) sit where clicked
pos = part.AbsolutePosition; autopilotTarget = part.AbsolutePosition + offset; // World location of clicked point
}
else return; // occupied small //Console.WriteLine(" offset ={0}", offset);
} // end large/small //Console.WriteLine(" UnscriptedSitPos={0}", m_avUnscriptedSitPos);
} // end Scripted/not //Console.WriteLine(" autopilotTarget={0}", autopilotTarget);
}
else // small offset
{
//Console.WriteLine("Small offset");
if (!part.IsOccupied)
{
m_avUnscriptedSitPos = Vector3.Zero; // Zero = Sit on prim center
autopilotTarget = part.AbsolutePosition;
}
else return; // occupied small
} // end large/small
} // end Scripted/not
cameraAtOffset = part.GetCameraAtOffset();
cameraEyeOffset = part.GetCameraEyeOffset();
forceMouselook = part.GetForceMouselook();
if (m_physicsActor != null) if (m_physicsActor != null)
{ {
// If we're not using the client autopilot, we're immediately warping the avatar to the location // If we're not using the client autopilot, we're immediately warping the avatar to the location
// We can remove the physicsActor until they stand up. // We can remove the physicsActor until they stand up.
m_sitAvatarHeight = m_physicsActor.Size.Z; m_sitAvatarHeight = m_physicsActor.Size.Z;
if (autopilot)
if (autopilot) { // its not a scripted sit
{ // its not a scripted sit // if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5)
if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5) if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) )
{ {
autopilot = false; // close enough autopilot = false; // close enough
RemoveFromPhysicalScene();
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, (m_sitAvatarHeight / 2.0f)); // Warp av to Prim
} // else the autopilot will get us close
}
else
{ // its a scripted sit
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
} AbsolutePosition = autopilotTarget + new Vector3(0.0f, 0.0f, (m_sitAvatarHeight / 2.0f)); // Warp av to over sit target
} // else the autopilot will get us close
}
else
{ // its a scripted sit
RemoveFromPhysicalScene();
} }
cameraAtOffset = part.GetCameraAtOffset();
cameraEyeOffset = part.GetCameraEyeOffset();
forceMouselook = part.GetForceMouselook();
} }
else return; // physactor is null!
ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); Vector3 offsetr = offset * partIRot;
m_requestedSitTargetUUID = targetID; ControllingClient.SendSitResponse(part.UUID, offsetr, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook);
m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target
// This calls HandleAgentSit twice, once from here, and the client calls // This calls HandleAgentSit twice, once from here, and the client calls
// HandleAgentSit itself after it gets to the location // HandleAgentSit itself after it gets to the location
// It doesn't get to the location until we've moved them there though // It doesn't get to the location until we've moved them there though
// which happens in HandleAgentSit :P // which happens in HandleAgentSit :P
m_autopilotMoving = autopilot; m_autopilotMoving = autopilot;
m_autoPilotTarget = pos; m_autoPilotTarget = autopilotTarget;
m_sitAtAutoTarget = autopilot; m_sitAtAutoTarget = autopilot;
m_initialSitTarget = autopilotTarget;
if (!autopilot) if (!autopilot)
HandleAgentSit(remoteClient, UUID); HandleAgentSit(remoteClient, UUID);
} }
@ -1913,6 +1916,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (part.GetAvatarOnSitTarget() == UUID) if (part.GetAvatarOnSitTarget() == UUID)
{ {
//Console.WriteLine("Scripted Sit");
// Scripted sit // Scripted sit
Vector3 sitTargetPos = part.SitTargetPosition; Vector3 sitTargetPos = part.SitTargetPosition;
Quaternion sitTargetOrient = part.SitTargetOrientation; Quaternion sitTargetOrient = part.SitTargetOrientation;
@ -1920,42 +1924,44 @@ namespace OpenSim.Region.Framework.Scenes
m_pos += SIT_TARGET_ADJUSTMENT; m_pos += SIT_TARGET_ADJUSTMENT;
m_bodyRot = sitTargetOrient; m_bodyRot = sitTargetOrient;
m_parentPosition = part.AbsolutePosition; m_parentPosition = part.AbsolutePosition;
part.IsOccupied = true;
} }
else else
{ {
//Console.WriteLine("NON Scripted Sit");
// if m_avUnscriptedSitPos is zero then Av sits above center
// Else Av sits at m_avUnscriptedSitPos
// Non-scripted sit by Kitto Flora 21Nov09 // Non-scripted sit by Kitto Flora 21Nov09
// Calculate angle of line from prim to Av // Calculate angle of line from prim to Av
Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos; Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos;
float y_diff = (m_avInitialPos.Y - sitTargetPos.Y); float y_diff = (m_avInitialPos.Y - sitTargetPos.Y);
float x_diff = ( m_avInitialPos.X - sitTargetPos.X); float x_diff = ( m_avInitialPos.X - sitTargetPos.X);
if(Math.Abs(x_diff) < 0.001f) x_diff = 0.001f; // avoid div by 0 if(Math.Abs(x_diff) < 0.001f) x_diff = 0.001f; // avoid div by 0
if(Math.Abs(y_diff) < 0.001f) y_diff = 0.001f; // avoid pol flip at 0 if(Math.Abs(y_diff) < 0.001f) y_diff = 0.001f; // avoid pol flip at 0
float sit_angle = (float)Math.Atan2( (double)y_diff, (double)x_diff); float sit_angle = (float)Math.Atan2( (double)y_diff, (double)x_diff);
Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
// NOTE: when sitting m_ pos and m_bodyRot are *relative* to the prim location/rotation, not 'World'. // NOTE: when sitting m_ pos and m_bodyRot are *relative* to the prim location/rotation, not 'World'.
// Av sits at world euler <0,0, z>, translated by part rotation // Av sits at world euler <0,0, z>, translated by part rotation
m_bodyRot = partIRot * Quaternion.CreateFromEulers(0f, 0f, sit_angle); // sit at 0,0,inv-click m_bodyRot = partIRot * Quaternion.CreateFromEulers(0f, 0f, sit_angle); // sit at 0,0,inv-click
m_parentPosition = part.AbsolutePosition; m_parentPosition = part.AbsolutePosition;
if(m_avUnscriptedSitPos != Vector3.Zero) part.IsOccupied = true;
{ // sit where clicked on big prim m_pos = new Vector3(0f, 0f, 0.05f) + // corrections to get Sit Animation
m_pos = m_avUnscriptedSitPos + (new Vector3(0.0f, 0f, 0.625f) * partIRot); (new Vector3(0.0f, 0f, 0.61f) * partIRot) + // located on center
} (new Vector3(0.34f, 0f, 0.0f) * m_bodyRot) +
else m_avUnscriptedSitPos; // adds click offset, if any
{ // sit at center of small prim //Set up raytrace to find top surface of prim
m_pos = new Vector3(0f, 0f, 0.05f) + Vector3 size = part.Scale;
(new Vector3(0.0f, 0f, 0.625f) * partIRot) + float mag = 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z));
(new Vector3(0.25f, 0f, 0.0f) * m_bodyRot); Vector3 start = part.AbsolutePosition + new Vector3(0f, 0f, mag);
//Set up raytrace to find top surface of prim Vector3 down = new Vector3(0f, 0f, -1f);
Vector3 size = part.Scale; //Console.WriteLine("st={0} do={1} ma={2}", start, down, mag);
float mag = 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z)); m_scene.PhysicsScene.RaycastWorld(
Vector3 start = part.AbsolutePosition + new Vector3(0f, 0f, mag);
Vector3 down = new Vector3(0f, 0f, -1f);
m_scene.PhysicsScene.RaycastWorld(
start, // Vector3 position, start, // Vector3 position,
down, // Vector3 direction, down, // Vector3 direction,
mag, // float length, mag, // float length,
SitAltitudeCallback); // retMethod SitAltitudeCallback); // retMethod
} // end small/big
} // end scripted/not } // end scripted/not
} }
else // no Av else // no Av
@ -1974,17 +1980,22 @@ namespace OpenSim.Region.Framework.Scenes
public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal) public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal)
{ {
// KF: 091202 There appears to be a bug in Prim Edit Size - the process sometimes make a prim that RayTrace no longer
// sees. Take/re-rez, or sim restart corrects the condition. Result of bug is incorrect sit height.
if(hitYN) if(hitYN)
{ {
// m_pos = Av offset from prim center to make look like on center // m_pos = Av offset from prim center to make look like on center
// m_parentPosition = Actual center pos of prim // m_parentPosition = Actual center pos of prim
// collisionPoint = spot on prim where we want to sit // collisionPoint = spot on prim where we want to sit
// collisionPoint.Z = global sit surface height
SceneObjectPart part = m_scene.GetSceneObjectPart(localid); SceneObjectPart part = m_scene.GetSceneObjectPart(localid);
Vector3 offset = (collisionPoint - m_parentPosition) * Quaternion.Inverse(part.RotationOffset); Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
float offZ = collisionPoint.Z - m_initialSitTarget.Z;
Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction
//Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset);
m_pos += offset; m_pos += offset;
// Console.WriteLine("m_pos={0}, offset={1} newsit={2}", m_pos, offset, newsit);
} }
} } // End SitAltitudeCallback KF.
/// <summary> /// <summary>
/// Event handler for the 'Always run' setting on the client /// Event handler for the 'Always run' setting on the client
@ -3735,5 +3746,16 @@ namespace OpenSim.Region.Framework.Scenes
m_reprioritization_called = false; m_reprioritization_called = false;
} }
} }
private Vector3 Quat2Euler(Quaternion rot){
float x = Utils.RAD_TO_DEG * (float)Math.Atan2((double)((2.0f * rot.X * rot.W) - (2.0f * rot.Y * rot.Z)) ,
(double)(1 - (2.0f * rot.X * rot.X) - (2.0f * rot.Z * rot.Z)));
float y = Utils.RAD_TO_DEG * (float)Math.Asin ((double)((2.0f * rot.X * rot.Y) + (2.0f * rot.Z * rot.W)));
float z = Utils.RAD_TO_DEG * (float)Math.Atan2(((double)(2.0f * rot.Y * rot.W) - (2.0f * rot.X * rot.Z)) ,
(double)(1 - (2.0f * rot.Y * rot.Y) - (2.0f * rot.Z * rot.Z)));
return(new Vector3(x,y,z));
}
} }
} }

View File

@ -17,6 +17,8 @@
<excludeFiles /> <excludeFiles />
</DeploymentInformation> </DeploymentInformation>
<Contents> <Contents>
<File name="./CM_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./CM_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />