本文整理汇总了C#中Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3类的典型用法代码示例。如果您正苦于以下问题:C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3类的具体用法?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3怎么用?C# Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3类属于命名空间,在下文中一共展示了Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: botCreateBot
public LSL_String botCreateBot(string FirstName, string LastName, string appearanceToClone, LSL_Vector startPos)
{
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botCreateBot", m_host, "bot", m_itemID))
return "";
IBotManager manager = World.RequestModuleInterface<IBotManager>();
if (manager != null)
return
new LSL_String(
manager.CreateAvatar(FirstName, LastName, m_host.ParentEntity.Scene,
UUID.Parse(appearanceToClone), m_host.OwnerID,
new Vector3((float) startPos.x, (float) startPos.y, (float) startPos.z)).
ToString());
return new LSL_String("");
}
示例2: 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;
Primitive.TextureEntry tex = part.Shape.Textures;
int face = 0;
if (idx < rules.Length)
face = (int)rules.GetLSLIntegerItem(idx++);
Primitive.TextureEntryFace texFace = tex.GetFace((uint)face);
if (code == (int)ScriptBaseClass.PRIM_NAME)
{
res.Add(new LSL_Integer(part.Name));
}
if (code == (int)ScriptBaseClass.PRIM_DESC)
{
res.Add(new LSL_Integer(part.Description));
}
if (code == (int)ScriptBaseClass.PRIM_MATERIAL)
{
res.Add(new LSL_Integer(part.Material));
}
if (code == (int)ScriptBaseClass.PRIM_PHYSICS)
{
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0)
res.Add(new LSL_Integer(1));
else
res.Add(new LSL_Integer(0));
}
if (code == (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));
}
if (code == (int)ScriptBaseClass.PRIM_PHANTOM)
{
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
res.Add(new LSL_Integer(1));
else
res.Add(new LSL_Integer(0));
}
if (code == (int)ScriptBaseClass.PRIM_POSITION)
{
Vector3 tmp = part.AbsolutePosition;
LSL_Vector v = new LSL_Vector(tmp.X,
tmp.Y,
tmp.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)
{
LSL_Rotation rtmp = llGetRootRotation();
LSL_Vector rpos = llGetRootPosition();
v = ((v - rpos) * rtmp) + rpos;
}
res.Add(v);
}
if (code == (int)ScriptBaseClass.PRIM_SIZE)
{
Vector3 tmp = part.Scale;
res.Add(new LSL_Vector(tmp.X,
tmp.Y,
tmp.Z));
}
if (code == (int)ScriptBaseClass.PRIM_ROTATION)
{
res.Add(GetPartRot(part));
}
if (code == (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.
if (primType == ScriptBaseClass.PRIM_TYPE_BOX ||
ScriptBaseClass.PRIM_TYPE_CYLINDER ||
ScriptBaseClass.PRIM_TYPE_PRISM)
{
res.Add(new LSL_Integer(Shape.ProfileCurve));
//.........这里部分代码省略.........
示例3: llSetCameraAtOffset
public void llSetCameraAtOffset(LSL_Vector offset)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
m_host.CameraAtOffset = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
}
示例4: llSetVehicleVectorParam
//CFK 9/28: Most, but not all of the underlying plumbing between here and the physics modules is in
//CFK 9/28: so these are not complete yet.
public void llSetVehicleVectorParam(int param, LSL_Vector vec)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
if (m_host.ParentGroup != null)
{
if (!m_host.ParentGroup.IsDeleted)
{
m_host.ParentGroup.RootPart.SetVehicleVectorParam(param,
new Vector3((float)vec.x, (float)vec.y, (float)vec.z));
}
}
}
示例5: llPushObject
public void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
bool pushrestricted = World.RegionInfo.RegionSettings.RestrictPushing;
bool pushAllowed = false;
bool pusheeIsAvatar = false;
UUID targetID = UUID.Zero;
if (!UUID.TryParse(target,out targetID))
return;
ScenePresence pusheeav = null;
Vector3 PusheePos = Vector3.Zero;
SceneObjectPart pusheeob = null;
ScenePresence avatar = World.GetScenePresence(targetID);
if (avatar != null)
{
pusheeIsAvatar = true;
// Pushee doesn't have a physics actor
if (avatar.PhysicsActor == null)
return;
// Pushee is in GodMode this pushing object isn't owned by them
if (avatar.GodLevel > 0 && m_host.OwnerID != targetID)
return;
pusheeav = avatar;
// Find pushee position
// Pushee Linked?
if (pusheeav.ParentID != UUID.Zero)
{
SceneObjectPart parentobj = World.GetSceneObjectPart(pusheeav.ParentID);
if (parentobj != null)
{
PusheePos = parentobj.AbsolutePosition;
}
else
{
PusheePos = pusheeav.AbsolutePosition;
}
}
else
{
PusheePos = pusheeav.AbsolutePosition;
}
}
if (!pusheeIsAvatar)
{
// not an avatar so push is not affected by parcel flags
pusheeob = World.GetSceneObjectPart((UUID)target);
// We can't find object
if (pusheeob == null)
return;
// Object not pushable. Not an attachment and has no physics component
if (!pusheeob.IsAttachment && pusheeob.PhysActor == null)
return;
PusheePos = pusheeob.AbsolutePosition;
pushAllowed = true;
}
else
{
IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
if (pushrestricted)
{
if (parcelManagement != null)
{
ILandObject targetlandObj = parcelManagement.GetLandObject(PusheePos.X, PusheePos.Y);
// We didn't find the parcel but region is push restricted so assume it is NOT ok
if (targetlandObj == null)
return;
// Need provisions for Group Owned here
if (m_host.OwnerID == targetlandObj.LandData.OwnerID ||
targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID)
{
pushAllowed = true;
}
}
}
else
{
if (parcelManagement != null)
{
ILandObject targetlandObj = parcelManagement.GetLandObject(PusheePos.X, PusheePos.Y);
if (targetlandObj == null)
{
// We didn't find the parcel but region isn't push restricted so assume it's ok
pushAllowed = true;
}
else
//.........这里部分代码省略.........
示例6: SetParticleSystem
private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
{
if (rules.Length == 0)
{
part.RemoveParticleSystem();
part.ParentGroup.HasGroupChanged = true;
}
else
{
Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues();
LSL_Vector tempv = new LSL_Vector();
float tempf = 0;
for (int i = 0; i < rules.Length; i += 2)
{
LSL_Integer rule = rules.GetLSLIntegerItem(i);
if (rule == (int)ScriptBaseClass.PSYS_PART_FLAGS)
{
prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
}
else if (rule == (int)ScriptBaseClass.PSYS_PART_START_COLOR)
{
tempv = rules.GetVector3Item(i + 1);
prules.PartStartColor.R = (float)tempv.x;
prules.PartStartColor.G = (float)tempv.y;
prules.PartStartColor.B = (float)tempv.z;
}
else if (rule == (int)ScriptBaseClass.PSYS_PART_START_ALPHA)
{
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartStartColor.A = tempf;
}
else if (rule == (int)ScriptBaseClass.PSYS_PART_END_COLOR)
{
tempv = rules.GetVector3Item(i + 1);
prules.PartEndColor.R = (float)tempv.x;
prules.PartEndColor.G = (float)tempv.y;
prules.PartEndColor.B = (float)tempv.z;
}
else if (rule == (int)ScriptBaseClass.PSYS_PART_END_ALPHA)
{
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartEndColor.A = tempf;
}
else if (rule == (int)ScriptBaseClass.PSYS_PART_START_SCALE)
{
tempv = rules.GetVector3Item(i + 1);
prules.PartStartScaleX = (float)tempv.x;
prules.PartStartScaleY = (float)tempv.y;
}
else if (rule == (int)ScriptBaseClass.PSYS_PART_END_SCALE)
{
tempv = rules.GetVector3Item(i + 1);
prules.PartEndScaleX = (float)tempv.x;
prules.PartEndScaleY = (float)tempv.y;
}
else if (rule == (int)ScriptBaseClass.PSYS_PART_MAX_AGE)
{
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.PartMaxAge = tempf;
}
else if (rule == (int)ScriptBaseClass.PSYS_SRC_ACCEL)
{
tempv = rules.GetVector3Item(i + 1);
prules.PartAcceleration.X = (float)tempv.x;
prules.PartAcceleration.Y = (float)tempv.y;
prules.PartAcceleration.Z = (float)tempv.z;
}
else if (rule == (int)ScriptBaseClass.PSYS_SRC_PATTERN)
{
int tmpi = (int)rules.GetLSLIntegerItem(i + 1);
prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
}
// PSYS_SRC_INNERANGLE and PSYS_SRC_ANGLE_BEGIN use the same variables. The
// PSYS_SRC_OUTERANGLE and PSYS_SRC_ANGLE_END also use the same variable. The
// client tells the difference between the two by looking at the 0x02 bit in
// the PartFlags variable.
else if (rule == (int)ScriptBaseClass.PSYS_SRC_INNERANGLE)
{
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.InnerAngle = (float)tempf;
prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
}
else if (rule == (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE)
{
tempf = (float)rules.GetLSLFloatItem(i + 1);
prules.OuterAngle = (float)tempf;
prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
//.........这里部分代码省略.........
示例7: llSitTarget
public void llSitTarget(LSL_Vector offset, LSL_Rotation rot)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
// LSL quaternions can normalize to 0, normal Quaternions can't.
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
rot.z = 1; // ZERO_ROTATION = 0,0,0,1
m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
m_host.SitTargetOrientation = Rot2Quaternion(rot);
m_host.ParentGroup.HasGroupChanged = true;
}
示例8: llScriptDanger
public LSL_Integer llScriptDanger(LSL_Vector pos)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
bool result = m_ScriptEngine.PipeEventsForScript(m_host, new Vector3((float)pos.x, (float)pos.y, (float)pos.z));
if (result)
{
return 1;
}
else
{
return 0;
}
}
示例9: llWater
public LSL_Float llWater(LSL_Vector offset)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
return World.RegionInfo.RegionSettings.WaterHeight;
}
示例10: llRotBetween
public LSL_Rotation llRotBetween(LSL_Vector a, LSL_Vector b)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
//A and B should both be normalized
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;
}
示例11: SetPrimitiveShapeParams
protected void SetPrimitiveShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, LSL_Vector dimple, byte fudge)
{
ObjectShapePacket.ObjectDataBlock shapeBlock;
shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow, twist);
// profile/path swapped for a sphere
shapeBlock.PathBegin = shapeBlock.ProfileBegin;
shapeBlock.PathEnd = shapeBlock.ProfileEnd;
shapeBlock.ProfileCurve += fudge;
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);
}
示例12: SetPrimitiveBlockShapeParams
protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist)
{
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.ProfileCurve = (byte)holeshape;
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 (hollow > 0.95)
{
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;
}
shapeBlock.PathTwistBegin = (sbyte)(100 * twist.x);
shapeBlock.PathTwist = (sbyte)(100 * twist.y);
shapeBlock.ObjectLocalID = part.LocalId;
// retain pathcurve
shapeBlock.PathCurve = part.Shape.PathCurve;
part.Shape.SculptEntry = false;
return shapeBlock;
}
示例13: llEdgeOfWorld
public LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
// edge will be used to pass the Region Coordinates offset
// we want to check for a neighboring sim
LSL_Vector edge = new LSL_Vector(0, 0, 0);
if (dir.x == 0)
{
if (dir.y == 0)
{
// Direction vector is 0,0 so return
// false since we're staying in the sim
return 0;
}
else
{
// Y is the only valid direction
edge.y = dir.y / Math.Abs(dir.y);
}
}
else
{
LSL_Float mag;
if (dir.x > 0)
{
mag = (World.RegionInfo.RegionSizeX - pos.x) / dir.x;
}
else
{
mag = (pos.x/dir.x);
}
mag = Math.Abs(mag);
edge.y = pos.y + (dir.y * mag);
if (edge.y > World.RegionInfo.RegionSizeY || edge.y < 0)
{
// Y goes out of bounds first
edge.y = dir.y / Math.Abs(dir.y);
}
else
{
// X goes out of bounds first or its a corner exit
edge.y = 0;
edge.x = dir.x / Math.Abs(dir.x);
}
}
INeighborService service = World.RequestModuleInterface<INeighborService>();
List<GridRegion> neighbors = new List<GridRegion>();
if (service != null)
{
neighbors = service.GetNeighbors(World.RegionInfo);
}
int neighborX = World.RegionInfo.RegionLocX + (int)dir.x;
int neighborY = World.RegionInfo.RegionLocY + (int)dir.y;
foreach (GridRegion sri in neighbors)
{
if (sri.RegionLocX == neighborX && sri.RegionLocY == neighborY)
return 0;
}
return 1;
}
示例14: llVecDist
public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
double dx = a.x - b.x;
double dy = a.y - b.y;
double dz = a.z - b.z;
return Math.Sqrt(dx * dx + dy * dy + dz * dz);
}
示例15: llVecNorm
public LSL_Vector llVecNorm(LSL_Vector v)
{
ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
return LSL_Vector.Norm(v);
}