本文整理汇总了C#中OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3类的典型用法代码示例。如果您正苦于以下问题:C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3类的具体用法?C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3怎么用?C# OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3类属于命名空间,在下文中一共展示了OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: llScriptDanger
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));
if (result)
{
return 1;
}
else
{
return 0;
}
}
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:14,代码来源:LSL_Api.cs
示例2: llSetCameraAtOffset
public void llSetCameraAtOffset(LSL_Vector offset)
{
m_host.AddScriptLPS(1);
m_host.SetCameraAtOffset(new Vector3((float)offset.x, (float)offset.y, (float)offset.z));
}
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:5,代码来源:LSL_Api.cs
示例3: llGetBoundingBox
/// <summary>
/// A partial implementation.
/// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetBoundingBox
/// So far only valid for standing/flying/ground sitting avatars and single prim objects.
/// If the object has multiple prims and/or a sitting avatar then the bounding
/// box is for the root prim only.
/// </summary>
public LSL_List llGetBoundingBox(string obj)
{
m_host.AddScriptLPS(1);
UUID objID = UUID.Zero;
LSL_List result = new LSL_List();
if (!UUID.TryParse(obj, out objID))
{
result.Add(new LSL_Vector());
result.Add(new LSL_Vector());
return result;
}
ScenePresence presence = World.GetScenePresence(objID);
if (presence != null)
{
if (presence.ParentID == 0) // not sat on an object
{
LSL_Vector lower;
LSL_Vector upper;
if (presence.Animator.Animations.DefaultAnimation.AnimID
== DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
{
// This is for ground sitting avatars
float height = presence.Appearance.AvatarHeight / 2.66666667f;
lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f);
upper = new LSL_Vector(0.3375f, 0.45f, 0.0f);
}
else
{
// This is for standing/flying avatars
float height = presence.Appearance.AvatarHeight / 2.0f;
lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f);
upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f);
}
result.Add(lower);
result.Add(upper);
return result;
}
else
{
// sitting on an object so we need the bounding box of that
// which should include the avatar so set the UUID to the
// UUID of the object the avatar is sat on and allow it to fall through
// to processing an object
SceneObjectPart p = World.GetSceneObjectPart(presence.ParentID);
objID = p.UUID;
}
}
SceneObjectPart part = World.GetSceneObjectPart(objID);
// Currently only works for single prims without a sitting avatar
if (part != null)
{
Vector3 halfSize = part.Scale / 2.0f;
LSL_Vector lower = new LSL_Vector(halfSize.X * -1.0f, halfSize.Y * -1.0f, halfSize.Z * -1.0f);
LSL_Vector upper = new LSL_Vector(halfSize.X, halfSize.Y, halfSize.Z);
result.Add(lower);
result.Add(upper);
return result;
}
// Not found so return empty values
result.Add(new LSL_Vector());
result.Add(new LSL_Vector());
return result;
}
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:71,代码来源:LSL_Api.cs
示例4: NpcCreate
private LSL_Key NpcCreate(
string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent, bool hostGroupID)
{
if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z)))
{
OSSLError("no permission to rez NPC at requested location");
return new LSL_Key(UUID.Zero.ToString());
}
INPCModule module = World.RequestModuleInterface<INPCModule>();
if(module == null)
{
OSSLError("NPC module not enabled");
return new LSL_Key(UUID.Zero.ToString());
}
string groupTitle = String.Empty;
UUID groupID = UUID.Zero;
AvatarAppearance appearance = null;
// check creation options
NPCOptionsFlags createFlags = module.NPCOptionFlags;
if((createFlags & NPCOptionsFlags.AllowNotOwned) == 0 && !owned)
{
OSSLError("Not owned NPCs disabled");
owned = true; // we should get here...
}
if((createFlags & NPCOptionsFlags.AllowSenseAsAvatar) == 0 && senseAsAgent)
{
OSSLError("NPC allow sense as Avatar disabled");
senseAsAgent = false;
}
if(hostGroupID && m_host.GroupID != UUID.Zero)
{
IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>();
if (groupsModule != null)
{
GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
if (member == null)
{
OSSLError(string.Format("osNpcCreate: the object owner is not member of the object group"));
return new LSL_Key(UUID.Zero.ToString());
}
groupID = m_host.GroupID;
if((createFlags & NPCOptionsFlags.NoNPCGroup) != 0)
{
GroupRecord grprec = groupsModule.GetGroupRecord(m_host.GroupID);
if(grprec != null && grprec.GroupName != "")
groupTitle = grprec.GroupName;
}
}
}
if((createFlags & NPCOptionsFlags.NoNPCGroup) == 0)
{
if (firstname != String.Empty || lastname != String.Empty)
{
if (firstname != "Shown outfit:")
groupTitle = "- NPC -";
}
}
if((createFlags & NPCOptionsFlags.AllowCloneOtherAvatars) != 0)
{
UUID id;
if (UUID.TryParse(notecard, out id))
{
ScenePresence clonePresence = World.GetScenePresence(id);
if (clonePresence != null)
appearance = clonePresence.Appearance;
}
}
if (appearance == null)
{
string appearanceSerialized = LoadNotecard(notecard);
if (appearanceSerialized != null)
{
try
{
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
appearance = new AvatarAppearance();
appearance.Unpack(appearanceOsd);
}
catch
{
OSSLError(string.Format("osNpcCreate: Error processing notcard '{0}'", notecard));
return new LSL_Key(UUID.Zero.ToString());
}
}
else
{
OSSLError(string.Format("osNpcCreate: Notecard reference '{0}' not found.", notecard));
//.........这里部分代码省略.........
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:101,代码来源:OSSL_Api.cs
示例5: llMapDestination
public void llMapDestination(string simname, LSL_Vector pos, LSL_Vector lookAt)
{
m_host.AddScriptLPS(1);
DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, 0);
if (detectedParams == null) return; // only works on the first detected avatar
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));
}
ScriptSleep(1000);
}
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:15,代码来源:LSL_Api.cs
示例6: modInvokeL
public LSL_List modInvokeL(string fname, params object[] parms)
{
Type returntype = m_comms.LookupReturnType(fname);
if (returntype != typeof(object[]))
MODError(String.Format("return type mismatch for {0}",fname));
object[] result = (object[])modInvoke(fname,parms);
object[] llist = new object[result.Length];
for (int i = 0; i < result.Length; i++)
{
if (result[i] is string)
{
llist[i] = new LSL_String((string)result[i]);
}
else if (result[i] is int)
{
llist[i] = new LSL_Integer((int)result[i]);
}
else if (result[i] is float)
{
llist[i] = new LSL_Float((float)result[i]);
}
else if (result[i] is UUID)
{
llist[i] = new LSL_Key(result[i].ToString());
}
else if (result[i] is OpenMetaverse.Vector3)
{
OpenMetaverse.Vector3 vresult = (OpenMetaverse.Vector3)result[i];
llist[i] = new LSL_Vector(vresult.X, vresult.Y, vresult.Z);
}
else if (result[i] is OpenMetaverse.Quaternion)
{
OpenMetaverse.Quaternion qresult = (OpenMetaverse.Quaternion)result[i];
llist[i] = new LSL_Rotation(qresult.X, qresult.Y, qresult.Z, qresult.W);
}
else
{
MODError(String.Format("unknown list element {1} returned by {0}", fname, result[i].GetType().Name));
}
}
return new LSL_List(llist);
}
开发者ID:p07r0457,项目名称:opensim,代码行数:44,代码来源:MOD_Api.cs
示例7: llLinkSitTarget
public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot)
{
m_host.AddScriptLPS(1);
if (link == ScriptBaseClass.LINK_ROOT)
SitTarget(m_host.ParentGroup.RootPart, offset, rot);
else if (link == ScriptBaseClass.LINK_THIS)
SitTarget(m_host, offset, rot);
else
{
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link);
if (null != part)
{
SitTarget(part, offset, rot);
}
}
}
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:16,代码来源:LSL_Api.cs
示例8: DropAttachmentAt
protected void DropAttachmentAt(bool checkPerms, LSL_Vector pos, LSL_Rotation rot)
{
if (checkPerms && ShoutErrorOnLackingOwnerPerms(ScriptBaseClass.PERMISSION_ATTACH, "Cannot drop attachment"))
{
return;
}
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
if (attachmentsModule != null && sp != null)
{
attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, pos, rot);
}
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:15,代码来源:OSSL_Api.cs
示例9: osForceDropAttachmentAt
public void osForceDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
{
CheckThreatLevel(ThreatLevel.High, "osForceDropAttachmentAt");
m_host.AddScriptLPS(1);
DropAttachmentAt(false, pos, rot);
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:7,代码来源:OSSL_Api.cs
示例10: osNpcCreate
public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, int options)
{
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
m_host.AddScriptLPS(1);
return NpcCreate(
firstname, lastname, position, notecard,
(options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0,
(options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0,
(options & ScriptBaseClass.OS_NPC_OBJECT_GROUP) != 0);
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:11,代码来源:OSSL_Api.cs
示例11: osNpcMoveTo
public void osNpcMoveTo(LSL_Key npc, LSL_Vector pos)
{
CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
{
UUID npcId;
if (!UUID.TryParse(npc.m_string, out npcId))
return;
if (!module.CheckPermissions(npcId, m_host.OwnerID))
return;
module.MoveToTarget(npcId, World, pos, false, true, false);
}
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:18,代码来源:OSSL_Api.cs
示例12: osParcelSubdivide
public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2)
{
CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide");
m_host.AddScriptLPS(1);
int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x);
int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y);
int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x);
int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y);
World.LandChannel.Subdivide(startx,starty,endx,endy,m_host.OwnerID);
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:12,代码来源:OSSL_Api.cs
示例13: SetParcelDetails
private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName)
{
m_host.AddScriptLPS(1);
// Get a reference to the land data and make sure the owner of the script
// can modify it
ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y);
if (startLandObject == null)
{
OSSLShoutError("There is no land at that location");
return;
}
if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false))
{
OSSLShoutError("You do not have permission to modify the parcel");
return;
}
// Create a new land data object we can modify
LandData newLand = startLandObject.LandData.Copy();
UUID uuid;
// Process the rules, not sure what the impact would be of changing owner or group
for (int idx = 0; idx < rules.Length;)
{
int code = rules.GetLSLIntegerItem(idx++);
string arg = rules.GetLSLStringItem(idx++);
switch (code)
{
case ScriptBaseClass.PARCEL_DETAILS_NAME:
newLand.Name = arg;
break;
case ScriptBaseClass.PARCEL_DETAILS_DESC:
newLand.Description = arg;
break;
case ScriptBaseClass.PARCEL_DETAILS_OWNER:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName);
if (UUID.TryParse(arg, out uuid))
newLand.OwnerID = uuid;
break;
case ScriptBaseClass.PARCEL_DETAILS_GROUP:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName);
if (UUID.TryParse(arg, out uuid))
newLand.GroupID = uuid;
break;
case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName);
newLand.ClaimDate = Convert.ToInt32(arg);
if (newLand.ClaimDate == 0)
newLand.ClaimDate = Util.UnixTimeSinceEpoch();
break;
}
}
World.LandChannel.UpdateLandObject(newLand.LocalID,newLand);
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:62,代码来源:OSSL_Api.cs
示例14: SetPrimitiveShapeParams
// Prim type sphere.
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte profileshape, byte pathcurve)
{
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist, profileshape, pathcurve);
// profile/path swapped for a sphere
shapeBlock.PathBegin = shapeBlock.ProfileBegin;
shapeBlock.PathEnd = shapeBlock.ProfileEnd;
shapeBlock.PathScaleX = 100;
shapeBlock.PathScaleY = 100;
if (dimple.x < 0f)
{
dimple.x = 0f;
}
if (dimple.x > 1f)
{
dimple.x = 1f;
}
if (dimple.y < 0f)
{
dimple.y = 0f;
}
if (dimple.y > 1f)
{
dimple.y = 1f;
}
if (dimple.y - cut.x < 0.05f)
{
dimple.x = cut.y - 0.05f;
}
shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x);
shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y));
part.Shape.SculptEntry = false;
part.UpdateShape(shapeBlock);
}
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:40,代码来源:LSL_Api.cs
示例15: SetPrimitiveBlockShapeParams
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
{
float tempFloat; // Use in float expressions below to avoid byte cast precision issues.
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
if (holeshape != (int)ScriptBaseClass.PRIM_HOLE_DEFAULT &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_CIRCLE &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_SQUARE &&
holeshape != (int)ScriptBaseClass.PRIM_HOLE_TRIANGLE)
{
holeshape = (int)ScriptBaseClass.PRIM_HOLE_DEFAULT;
}
shapeBlock.PathCurve = pathcurve;
shapeBlock.ProfileCurve = (byte)holeshape; // Set the hole shape.
shapeBlock.ProfileCurve += profileshape; // Add in the profile shape.
if (cut.x < 0f)
{
cut.x = 0f;
}
if (cut.x > 1f)
{
cut.x = 1f;
}
if (cut.y < 0f)
{
cut.y = 0f;
}
if (cut.y > 1f)
{
cut.y = 1f;
}
if (cut.y - cut.x < 0.05f)
{
cut.x = cut.y - 0.05f;
if (cut.x < 0.0f)
{
cut.x = 0.0f;
cut.y = 0.05f;
}
}
shapeBlock.ProfileBegin = (ushort)(50000 * cut.x);
shapeBlock.ProfileEnd = (ushort)(50000 * (1 - cut.y));
if (hollow < 0f)
{
hollow = 0f;
}
// If the prim is a Cylinder, Prism, Sphere, Torus or Ring (or not a
// Box or Tube) and the hole shape is a square, hollow is limited to
// a max of 70%. The viewer performs its own check on this value but
// we need to do it here also so llGetPrimitiveParams can have access
// to the correct value.
if (profileshape != (byte)ProfileCurve.Square &&
holeshape == (int)ScriptBaseClass.PRIM_HOLE_SQUARE)
{
if (hollow > 0.70f)
{
hollow = 0.70f;
}
}
// Otherwise, hollow is limited to 95%.
else
{
if (hollow > 0.95f)
{
hollow = 0.95f;
}
}
shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
if (twist.x < -1.0f)
{
twist.x = -1.0f;
}
if (twist.x > 1.0f)
{
twist.x = 1.0f;
}
if (twist.y < -1.0f)
{
twist.y = -1.0f;
}
if (twist.y > 1.0f)
{
twist.y = 1.0f;
}
// A fairly large precision error occurs for some calculations,
// if a float or double is directly cast to a byte or sbyte
// variable, in both .Net and Mono. In .Net, coding
// "(sbyte)(float)(some expression)" corrects the precision
// errors. But this does not work for Mono. This longer coding
// form of creating a tempoary float variable from the
// expression first, then casting that variable to a byte or
// sbyte, works for both .Net and Mono. These types of
// assignments occur in SetPrimtiveBlockShapeParams and
// SetPrimitiveShapeParams in support of llSetPrimitiveParams.
tempFloat = (float)(100.0d * twist.x);
shapeBlock.PathTwistBegin = (sbyte)tempFloat;
tempFloat = (float)(100.0d * twist.y);
shapeBlock.PathTwist = (sbyte)tempFloat;
shapeBlock.ObjectLocalID = part.LocalId;
//.........这里部分代码省略.........
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:101,代码来源:LSL_Api.cs
示例16: llRotBetween
public LSL_Rotation llRotBetween(LSL_Vector a, LSL_Vector b)
{
//A and B should both be normalized
m_host.AddScriptLPS(1);
LSL_Rotation rotBetween;
// Check for zero vectors. If either is zero, return zero rotation. Otherwise,
// continue calculation.
if (a == new LSL_Vector(0.0f, 0.0f, 0.0f) || b == new LSL_Vector(0.0f, 0.0f, 0.0f))
{
rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
}
else
{
a = LSL_Vector.Norm(a);
b = LSL_Vector.Norm(b);
double dotProduct = LSL_Vector.Dot(a, b);
// There are two degenerate cases possible. These are for vectors 180 or
// 0 degrees apart. These have to be detected and handled individually.
//
// Check for vectors 180 degrees apart.
// A dot product of -1 would mean the angle between vectors is 180 degrees.
if (dotProduct < -0.9999999f)
{
// First assume X axis is orthogonal to the vectors.
LSL_Vector orthoVector = new LSL_Vector(1.0f, 0.0f, 0.0f);
orthoVector = orthoVector - a * (a.x / LSL_Vector.Dot(a, a));
// Check for near zero vector. A very small non-zero number here will create
// a rotation in an undesired direction.
if (LSL_Vector.Mag(orthoVector) > 0.0001)
{
rotBetween = new LSL_Rotation(orthoVector.x, orthoVector.y, orthoVector.z, 0.0f);
}
// If the magnitude of the vector was near zero, then assume the X axis is not
// orthogonal and use the Z axis instead.
else
{
// Set 180 z rotation.
rotBetween = new LSL_Rotation(0.0f, 0.0f, 1.0f, 0.0f);
}
}
// Check for parallel vectors.
// A dot product of 1 would mean the angle between vectors is 0 degrees.
else if (dotProduct > 0.9999999f)
{
// Set zero rotation.
rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
}
else
{
// All special checks have been performed so get the axis of rotation.
LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
// Quarternion s value is the length of the unit vector + dot product.
double qs = 1.0 + dotProduct;
rotBetween = new LSL_Rotation(crossProduct.x, crossProduct.y, crossProduct.z, qs);
// Normalize the rotation.
double mag = LSL_Rotation.Mag(rotBetween);
// We shouldn't have to worry about a divide by zero here. The qs value will be
// non-zero because we already know if we're here, then the dotProduct is not -1 so
// qs will not be zero. Also, we've already handled the input vectors being zero so the
// crossProduct vector should also not be zero.
rotBetween.x = rotBetween.x / mag;
rotBetween.y = rotBetween.y / mag;
rotBetween.z = rotBetween.z / mag;
rotBetween.s = rotBetween.s / mag;
// Check for undefined values and set zero rotation if any found. This code might not actually be required
// any longer since zero vectors are checked for at the top.
if (Double.IsNaN(rotBetween.x) || Double.IsNaN(rotBetween.y) || Double.IsNaN(rotBetween.z) || Double.IsNaN(rotBetween.s))
{
rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
}
}
}
return rotBetween;
}
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:74,代码来源:LSL_Api.cs
示例17: NpcCreate
private LSL_Key NpcCreate(
string firstname, string lastname, LSL_Vector position, string notecard, bool owned, bool senseAsAgent)
{
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
{
AvatarAppearance appearance = null;
UUID id;
if (UUID.TryParse(notecard, out id))
{
ScenePresence clonePresence = World.GetScenePresence(id);
if (clonePresence != null)
appearance = clonePresence.Appearance;
}
if (appearance == null)
{
string appearanceSerialized = LoadNotecard(notecard);
if (appearanceSerialized != null)
{
OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
appearance = new AvatarAppearance();
appearance.Unpack(appearanceOsd);
}
}
if (appearance == null)
return new LSL_Key(UUID.Zero.ToString());
UUID ownerID = UUID.Zero;
if (owned)
ownerID = m_host.OwnerID;
UUID x = module.CreateNPC(firstname,
lastname,
position,
ownerID,
senseAsAgent,
World,
appearance);
return new LSL_Key(x.ToString());
}
return new LSL_Key(UUID.Zero.ToString());
}
开发者ID:p07r0457,项目名称:opensim,代码行数:47,代码来源:OSSL_Api.cs
示例18: osGetDrawStringSize
public LSL_Vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize)
{
CheckThreatLevel(ThreatLevel.VeryLow, "osGetDrawStringSize");
m_host.AddScriptLPS(1);
LSL_Vector vec = new LSL_Vector(0,0,0);
IDynamicTextureManager textureManager = World.RequestModuleInterface<IDynamicTextureManager>();
if (textureManager != null)
{
double xSize, ySize;
textureManager.GetDrawStringSize(contentType, text, fontName, fontSize,
out xSize, out ySize);
vec.x = xSize;
vec.y = ySize;
}
return vec;
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:17,代码来源:OSSL_Api.cs
示例19: GetLinkPrimitiveParams
public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules)
{
LSL_List res = new LSL_List();
int idx=0;
while (idx < rules.Length)
{
int code=(int)rules.GetLSLIntegerItem(idx++);
int remain=rules.Length-idx;
switch (code)
{
case (int)ScriptBaseClass.PRIM_MATERIAL:
res.Add(new LSL_Integer(part.Material));
break;
case (int)ScriptBaseClass.PRIM_PHYSICS:
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0)
res.Add(new LSL_Integer(1));
else
res.Add(new LSL_Integer(0));
break;
case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0)
res.Add(new LSL_Integer(1));
else
res.Add(new LSL_Integer(0));
break;
case (int)ScriptBaseClass.PRIM_PHANTOM:
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
res.Add(new LSL_Integer(1));
else
res.Add(new LSL_Integer(0));
break;
case (int)ScriptBaseClass.PRIM_POSITION:
LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X,
part.AbsolutePosition.Y,
part.AbsolutePosition.Z);
// For some reason, the part.AbsolutePosition.* values do not change if the
// linkset is rotated; they always reflect the child prim's world position
// as though the linkset is unrotated. This is incompatible behavior with SL's
// implementation, so will break scripts imported from there (not to mention it
// makes it more difficult to determine a child prim's actual inworld position).
if (part.ParentID != 0)
v = ((v - llGetRootPosition()) * llGetRootRotation()) + llGetRootPosition();
res.Add(v);
break;
case (int)ScriptBaseClass.PRIM_SIZE:
res.Add(new LSL_Vector(part.Scale.X,
part.Scale.Y,
part.Scale.Z));
break;
case (int)ScriptBaseClass.PRIM_ROTATION:
res.Add(GetPartRot(part));
break;
case (int)ScriptBaseClass.PRIM_TYPE:
// implementing box
PrimitiveBaseShape Shape = part.Shape;
int primType = (int)part.GetPrimType();
res.Add(new LSL_Integer(primType));
double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY.
switch (primType)
{
case ScriptBaseClass.PRIM_TYPE_BOX:
case ScriptBaseClass.PRIM_TYPE_CYLINDER:
case ScriptBaseClass.PRIM_TYPE_PRISM:
res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
res.Add(new LSL_Vector(topshearx, topsheary, 0));
break;
case ScriptBaseClass.PRIM_TYPE_SPHERE:
res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
break;
case ScriptBaseClass.PRIM_TYPE_SCULPT:
res.Add(Shape.SculptTexture.ToString());
res.Add(new LSL_Integer(Shape.SculptType));
break;
case ScriptBaseClass.PRIM_TYPE_RING:
case ScriptBaseClass.PRIM_TYPE_TUBE:
case ScriptBaseClass.PRIM_TYPE_TORUS:
// holeshape
res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble.
// cut
//.........这里部分代码省略.........
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:101,代码来源:LSL_Api.cs
示例20: osSetParcelDetails
public void osSetParcelDetails(LSL_Vector pos, LSL_List rules)
{
const string functionName = "osSetParcelDetails";
CheckThreatLevel(ThreatLevel.High, functionName);
SetParcelDetails(pos, rules, functionName);
}
开发者ID:nebadon2025,项目名称:opensimulator,代码行数:6,代码来源:OSSL_Api.cs
注:本文中的OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论