Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
avinationmerge
Melanie 2012-08-18 13:57:50 +01:00
commit 5d43e27de2
9 changed files with 119 additions and 124 deletions

View File

@ -1240,9 +1240,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Float llGround(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x,
(float)offset.y,
(float)offset.z);
Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
//Get the slope normal. This gives us the equation of the plane tangent to the slope.
LSL_Vector vsn = llGroundNormal(offset);
@ -1578,7 +1576,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face == ScriptBaseClass.ALL_SIDES)
face = SceneObjectPart.ALL_SIDES;
m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
m_host.SetFaceColor(color, face);
}
public void SetTexGen(SceneObjectPart part, int face,int style)
@ -2208,7 +2206,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
bool sameParcel = here.GlobalID == there.GlobalID;
if (!sameParcel && !World.Permissions.CanObjectEntry(m_host.UUID, false, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)))
if (!sameParcel && !World.Permissions.CanRezObject(
m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, pos))
{
return 0;
}
@ -2267,16 +2266,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (part.ParentGroup.RootPart == part)
{
SceneObjectGroup parent = part.ParentGroup;
Vector3 dest = new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z);
if (!World.Permissions.CanObjectEntry(parent.UUID, false, dest))
if (!World.Permissions.CanObjectEntry(parent.UUID, false, (Vector3)toPos))
return;
Util.FireAndForget(delegate(object x) {
parent.UpdateGroupPosition(dest);
parent.UpdateGroupPosition((Vector3)toPos);
});
}
else
{
part.OffsetPosition = new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z);
part.OffsetPosition = (Vector3)toPos;
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
@ -2314,7 +2312,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
pos = part.AbsolutePosition;
}
return new LSL_Vector(pos.X, pos.Y, pos.Z);
// m_log.DebugFormat("[LSL API]: Returning {0} in GetPartLocalPos()", pos);
return new LSL_Vector(pos);
}
public void llSetRot(LSL_Rotation rot)
@ -2464,7 +2464,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (local != 0)
force *= llGetRot();
m_host.ParentGroup.RootPart.SetForce(new Vector3((float)force.x, (float)force.y, (float)force.z));
m_host.ParentGroup.RootPart.SetForce(force);
}
}
@ -2476,10 +2476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_host.ParentGroup.IsDeleted)
{
Vector3 tmpForce = m_host.ParentGroup.RootPart.GetForce();
force.x = tmpForce.X;
force.y = tmpForce.Y;
force.z = tmpForce.Z;
force = m_host.ParentGroup.RootPart.GetForce();
}
return force;
@ -2488,8 +2485,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llTarget(LSL_Vector position, double range)
{
m_host.AddScriptLPS(1);
return m_host.ParentGroup.registerTargetWaypoint(
new Vector3((float)position.x, (float)position.y, (float)position.z), (float)range);
return m_host.ParentGroup.registerTargetWaypoint(position,
(float)range);
}
public void llTargetRemove(int number)
@ -2514,7 +2511,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llMoveToTarget(LSL_Vector target, double tau)
{
m_host.AddScriptLPS(1);
m_host.MoveToTarget(new Vector3((float)target.x, (float)target.y, (float)target.z), (float)tau);
m_host.MoveToTarget(target, (float)tau);
}
public void llStopMoveToTarget()
@ -2527,7 +2524,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
//No energy force yet
Vector3 v = new Vector3((float)force.x, (float)force.y, (float)force.z);
Vector3 v = force;
if (v.Length() > 20000.0f)
{
v.Normalize();
@ -2540,13 +2537,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llApplyRotationalImpulse(LSL_Vector force, int local)
{
m_host.AddScriptLPS(1);
m_host.ParentGroup.RootPart.ApplyAngularImpulse(new Vector3((float)force.x, (float)force.y, (float)force.z), local != 0);
m_host.ParentGroup.RootPart.ApplyAngularImpulse(force, local != 0);
}
public void llSetTorque(LSL_Vector torque, int local)
{
m_host.AddScriptLPS(1);
m_host.ParentGroup.RootPart.SetAngularImpulse(new Vector3((float)torque.x, (float)torque.y, (float)torque.z), local != 0);
m_host.ParentGroup.RootPart.SetAngularImpulse(torque, local != 0);
}
public LSL_Vector llGetTorque()
@ -3111,13 +3108,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
// need the magnitude later
// float velmag = (float)Util.GetMagnitude(llvel);
SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param);
SceneObjectGroup new_group = World.RezObject(m_host, item, pos, Rot2Quaternion(rot), vel, param);
// If either of these are null, then there was an unknown error.
if (new_group == null)
@ -3144,11 +3138,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
PhysicsActor pa = new_group.RootPart.PhysActor;
if (pa != null && pa.IsPhysical && llvel != Vector3.Zero)
if (pa != null && pa.IsPhysical && (Vector3)vel != Vector3.Zero)
{
float groupmass = new_group.GetMass();
llvel *= -groupmass;
llApplyImpulse(new LSL_Vector(llvel.X, llvel.Y,llvel.Z), 0);
vel *= -groupmass;
llApplyImpulse(vel, 0);
}
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
return;
@ -3706,7 +3700,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain)
{
part.UpdateAngularVelocity(new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)));
part.UpdateAngularVelocity(axis * spinrate);
}
public LSL_Integer llGetStartParameter()
@ -3916,7 +3910,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
try
{
foreach (SceneObjectPart part in parts)
part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
part.SetFaceColor(color, face);
}
finally
{
@ -4386,8 +4380,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetText(string text, LSL_Vector color, double alpha)
{
m_host.AddScriptLPS(1);
Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y,
(float)color.z), 0.0f, 1.0f);
Vector3 av3 = Util.Clip(color, 0.0f, 1.0f);
m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
//m_host.ParentGroup.HasGroupChanged = true;
//m_host.ParentGroup.ScheduleGroupForFullUpdate();
@ -4603,14 +4596,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(5000);
}
public void llTeleportAgent(string agent, string destination, LSL_Vector pos, LSL_Vector lookAt)
public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
{
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
@ -4639,15 +4629,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector pos, LSL_Vector lookAt)
public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt)
{
m_host.AddScriptLPS(1);
UUID agentId = new UUID();
ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y);
Vector3 targetPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
Vector3 targetLookAt = new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z);
if (UUID.TryParse(agent, out agentId))
{
ScenePresence presence = World.GetScenePresence(agentId);
@ -4944,7 +4932,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
distance_attenuation = 1f / normalized_units;
}
Vector3 applied_linear_impulse = new Vector3((float)impulse.x, (float)impulse.y, (float)impulse.z);
Vector3 applied_linear_impulse = impulse;
{
float impulse_length = applied_linear_impulse.Length();
@ -6505,9 +6493,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//Plug the x,y coordinates of the slope normal into the equation of the plane to get
//the height of that point on the plane. The resulting vector gives the slope.
Vector3 vsl = new Vector3();
vsl.X = (float)vsn.x;
vsl.Y = (float)vsn.y;
Vector3 vsl = vsn;
vsl.Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z));
vsl.Normalize();
//Normalization might be overkill here
@ -6518,9 +6504,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGroundNormal(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x,
(float)offset.y,
(float)offset.z);
Vector3 pos = m_host.GetWorldPosition() + (Vector3)offset;
// Clamp to valid position
if (pos.X < 0)
pos.X = 0;
@ -6974,8 +6958,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param, vec);
}
}
@ -7017,7 +7000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
rot.s = 1; // ZERO_ROTATION = 0,0,0,1
part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
part.SitTargetPosition = offset;
part.SitTargetOrientation = Rot2Quaternion(rot);
part.ParentGroup.HasGroupChanged = true;
}
@ -7121,13 +7104,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llSetCameraEyeOffset(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
m_host.SetCameraEyeOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z));
m_host.SetCameraEyeOffset(offset);
}
public void llSetCameraAtOffset(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z));
m_host.SetCameraAtOffset(offset);
}
public LSL_String llDumpList2String(LSL_List src, string seperator)
@ -7149,7 +7132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llScriptDanger(LSL_Vector pos)
{
m_host.AddScriptLPS(1);
bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z));
bool result = World.ScriptDanger(m_host.LocalId, pos);
if (result)
{
return 1;
@ -8263,7 +8246,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Vector color=rules.GetVector3Item(idx++);
double alpha=(double)rules.GetLSLFloatItem(idx++);
part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
part.SetFaceColor(color, face);
SetAlpha(part, alpha, face);
break;
@ -8412,9 +8395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string primText = rules.GetLSLStringItem(idx++);
LSL_Vector primTextColor = rules.GetVector3Item(idx++);
LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x,
(float)primTextColor.y,
(float)primTextColor.z), 0.0f, 1.0f);
Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f);
part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
break;
@ -8470,12 +8451,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
SceneObjectGroup parent = part.ParentGroup;
Util.FireAndForget(delegate(object x) {
parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
parent.UpdateGroupPosition(currentPosition);
});
}
else
{
part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z);
part.OffsetPosition = currentPosition;
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
@ -11161,9 +11142,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence avatar = World.GetScenePresence(detectedParams.Key);
if (avatar != null)
{
avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, simname,
new Vector3((float)pos.x, (float)pos.y, (float)pos.z),
new Vector3((float)lookAt.x, (float)lookAt.y, (float)lookAt.z));
avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
simname, pos, lookAt);
}
ScriptSleep(1000);
@ -12510,8 +12490,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
Vector3 rayStart = new Vector3((float)start.x, (float)start.y, (float)start.z);
Vector3 rayEnd = new Vector3((float)end.x, (float)end.y, (float)end.z);
Vector3 rayStart = start;
Vector3 rayEnd = end;
Vector3 dir = rayEnd - rayStart;
float dist = Vector3.Mag(dir);

View File

@ -304,7 +304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
idx++;
iV = rules.GetVector3Item(idx);
wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
wl.cloudDetailXYDensity = iV;
break;
case (int)ScriptBaseClass.WL_CLOUD_SCALE:
idx++;
@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
idx++;
iV = rules.GetVector3Item(idx);
wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
wl.cloudXYDensity = iV;
break;
case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
idx++;
@ -384,7 +384,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
idx++;
iV = rules.GetVector3Item(idx);
wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
wl.reflectionWaveletScale = iV;
break;
case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
idx++;
@ -422,7 +422,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.WL_WATER_COLOR:
idx++;
iV = rules.GetVector3Item(idx);
wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
wl.waterColor = iV;
break;
case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
idx++;

View File

@ -343,8 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (type == typeof(OpenMetaverse.Vector3))
{
LSL_Vector vect = (LSL_Vector)lslparm;
return new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
return (OpenMetaverse.Vector3)((LSL_Vector)lslparm);
}
}
@ -372,8 +371,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else if (plist[i] is LSL_Vector)
{
LSL_Vector vect = (LSL_Vector)plist[i];
result[i] = new OpenMetaverse.Vector3((float)vect.x,(float)vect.y,(float)vect.z);
result[i] = (OpenMetaverse.Vector3)(
(LSL_Vector)plist[i]);
}
else
MODError("unknown LSL list element type");

View File

@ -782,10 +782,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// We will launch the teleport on a new thread so that when the script threads are terminated
// before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
Util.FireAndForget(
o => World.RequestTeleportLocation(presence.ControllingClient, regionName,
new Vector3((float)position.x, (float)position.y, (float)position.z),
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
Util.FireAndForget(o => World.RequestTeleportLocation(
presence.ControllingClient, regionName, position,
lookat, (uint)TPFlags.ViaLocation));
ScriptSleep(5000);
@ -828,10 +827,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// We will launch the teleport on a new thread so that when the script threads are terminated
// before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
Util.FireAndForget(
o => World.RequestTeleportLocation(presence.ControllingClient, regionHandle,
new Vector3((float)position.x, (float)position.y, (float)position.z),
new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation));
Util.FireAndForget(o => World.RequestTeleportLocation(
presence.ControllingClient, regionHandle,
position, lookat, (uint)TPFlags.ViaLocation));
ScriptSleep(5000);
@ -2355,7 +2353,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ownerID = m_host.OwnerID;
UUID x = module.CreateNPC(firstname,
lastname,
new Vector3((float) position.x, (float) position.y, (float) position.z),
position,
ownerID,
senseAsAgent,
World,
@ -2478,7 +2476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Vector(0, 0, 0);
}
public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos)
{
CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
m_host.AddScriptLPS(1);
@ -2493,7 +2491,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!module.CheckPermissions(npcId, m_host.OwnerID))
return;
Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z);
module.MoveToTarget(npcId, World, pos, false, true, false);
}
}
@ -2513,11 +2510,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!module.CheckPermissions(npcId, m_host.OwnerID))
return;
Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z);
module.MoveToTarget(
new UUID(npc.m_string),
World,
pos,
target,
(options & ScriptBaseClass.OS_NPC_NO_FLY) != 0,
(options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0,
(options & ScriptBaseClass.OS_NPC_RUNNING) != 0);

View File

@ -429,9 +429,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
try
{
Vector3 diff = toRegionPos - fromRegionPos;
LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z);
double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir);
double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
double dot = LSL_Types.Vector3.Dot(forward_dir, diff);
double mag_obj = LSL_Types.Vector3.Mag(diff);
ang_obj = Math.Acos(dot / (mag_fwd * mag_obj));
}
catch
@ -564,8 +563,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
double ang_obj = 0;
try
{
Vector3 diff = toRegionPos - fromRegionPos;
LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(diff.X, diff.Y, diff.Z);
LSL_Types.Vector3 obj_dir = new LSL_Types.Vector3(
toRegionPos - fromRegionPos);
double dot = LSL_Types.Vector3.Dot(forward_dir, obj_dir);
double mag_obj = LSL_Types.Vector3.Mag(obj_dir);
ang_obj = Math.Acos(dot / (mag_fwd * mag_obj));

View File

@ -164,11 +164,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
else
{
// Set the values from the touch data provided by the client
touchST = new LSL_Types.Vector3(value.STCoord.X, value.STCoord.Y, value.STCoord.Z);
touchUV = new LSL_Types.Vector3(value.UVCoord.X, value.UVCoord.Y, value.UVCoord.Z);
touchNormal = new LSL_Types.Vector3(value.Normal.X, value.Normal.Y, value.Normal.Z);
touchBinormal = new LSL_Types.Vector3(value.Binormal.X, value.Binormal.Y, value.Binormal.Z);
touchPos = new LSL_Types.Vector3(value.Position.X, value.Position.Y, value.Position.Z);
touchST = new LSL_Types.Vector3(value.STCoord);
touchUV = new LSL_Types.Vector3(value.UVCoord);
touchNormal = new LSL_Types.Vector3(value.Normal);
touchBinormal = new LSL_Types.Vector3(value.Binormal);
touchPos = new LSL_Types.Vector3(value.Position);
touchFace = value.FaceIndex;
}
}
@ -189,19 +189,13 @@ namespace OpenSim.Region.ScriptEngine.Shared
Country = account.UserCountry;
Owner = Key;
Position = new LSL_Types.Vector3(
presence.AbsolutePosition.X,
presence.AbsolutePosition.Y,
presence.AbsolutePosition.Z);
Position = new LSL_Types.Vector3(presence.AbsolutePosition);
Rotation = new LSL_Types.Quaternion(
presence.Rotation.X,
presence.Rotation.Y,
presence.Rotation.Z,
presence.Rotation.W);
Velocity = new LSL_Types.Vector3(
presence.Velocity.X,
presence.Velocity.Y,
presence.Velocity.Z);
Velocity = new LSL_Types.Vector3(presence.Velocity);
Type = 0x01; // Avatar
if (presence.PresenceType == PresenceType.Npc)
@ -254,16 +248,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
}
}
Position = new LSL_Types.Vector3(part.AbsolutePosition.X,
part.AbsolutePosition.Y,
part.AbsolutePosition.Z);
Position = new LSL_Types.Vector3(part.AbsolutePosition);
Quaternion wr = part.ParentGroup.GroupRotation;
Rotation = new LSL_Types.Quaternion(wr.X, wr.Y, wr.Z, wr.W);
Velocity = new LSL_Types.Vector3(part.Velocity.X,
part.Velocity.Y,
part.Velocity.Z);
Velocity = new LSL_Types.Vector3(part.Velocity);
}
}

View File

@ -31,6 +31,11 @@ using System.Globalization;
using System.Text.RegularExpressions;
using OpenSim.Framework;
using OpenMetaverse;
using OMV_Vector3 = OpenMetaverse.Vector3;
using OMV_Vector3d = OpenMetaverse.Vector3d;
using OMV_Quaternion = OpenMetaverse.Quaternion;
namespace OpenSim.Region.ScriptEngine.Shared
{
[Serializable]
@ -54,6 +59,20 @@ namespace OpenSim.Region.ScriptEngine.Shared
z = (float)vector.z;
}
public Vector3(OMV_Vector3 vector)
{
x = vector.X;
y = vector.Y;
z = vector.Z;
}
public Vector3(OMV_Vector3d vector)
{
x = vector.X;
y = vector.Y;
z = vector.Z;
}
public Vector3(double X, double Y, double Z)
{
x = X;
@ -109,6 +128,26 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new list(new object[] { vec });
}
public static implicit operator OMV_Vector3(Vector3 vec)
{
return new OMV_Vector3((float)vec.x, (float)vec.y, (float)vec.z);
}
public static implicit operator Vector3(OMV_Vector3 vec)
{
return new Vector3(vec);
}
public static implicit operator OMV_Vector3d(Vector3 vec)
{
return new OMV_Vector3d(vec.x, vec.y, vec.z);
}
public static implicit operator Vector3(OMV_Vector3d vec)
{
return new Vector3(vec);
}
public static bool operator ==(Vector3 lhs, Vector3 rhs)
{
return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z);

View File

@ -152,9 +152,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
det[0] = new DetectParams();
det[0].Key = remoteClient.AgentId;
det[0].Populate(myScriptEngine.World);
det[0].OffsetPos = new LSL_Types.Vector3(offsetPos.X,
offsetPos.Y,
offsetPos.Z);
det[0].OffsetPos = offsetPos;
if (originalID == 0)
{
@ -298,9 +296,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
d.Position = new LSL_Types.Vector3(detobj.posVector.X,
detobj.posVector.Y,
detobj.posVector.Z);
d.Position = detobj.posVector;
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
@ -318,9 +314,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
d.Position = new LSL_Types.Vector3(detobj.posVector.X,
detobj.posVector.Y,
detobj.posVector.Z);
d.Position = detobj.posVector;
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
@ -337,9 +331,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (DetectedObject detobj in col.Colliders)
{
DetectParams d = new DetectParams();
d.Position = new LSL_Types.Vector3(detobj.posVector.X,
detobj.posVector.Y,
detobj.posVector.Z);
d.Position = detobj.posVector;
d.Populate(myScriptEngine.World);
det.Add(d);
myScriptEngine.PostObjectEvent(localID, new EventParams(
@ -381,8 +373,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
myScriptEngine.PostObjectEvent(localID, new EventParams(
"at_target", new object[] {
new LSL_Types.LSLInteger(handle),
new LSL_Types.Vector3(targetpos.X,targetpos.Y,targetpos.Z),
new LSL_Types.Vector3(atpos.X,atpos.Y,atpos.Z) },
new LSL_Types.Vector3(targetpos),
new LSL_Types.Vector3(atpos) },
new DetectParams[0]));
}

View File

@ -1556,7 +1556,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
else if (p[i] is string)
lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
else if (p[i] is Vector3)
lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z);
lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
else if (p[i] is Quaternion)
lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
else if (p[i] is float)
@ -1582,7 +1582,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
else if (p[i] is string)
lsl_p[i] = new LSL_Types.LSLString((string)p[i]);
else if (p[i] is Vector3)
lsl_p[i] = new LSL_Types.Vector3(((Vector3)p[i]).X, ((Vector3)p[i]).Y, ((Vector3)p[i]).Z);
lsl_p[i] = new LSL_Types.Vector3((Vector3)p[i]);
else if (p[i] is Quaternion)
lsl_p[i] = new LSL_Types.Quaternion(((Quaternion)p[i]).X, ((Quaternion)p[i]).Y, ((Quaternion)p[i]).Z, ((Quaternion)p[i]).W);
else if (p[i] is float)