本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectPart.GetPrimType方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectPart.GetPrimType方法的具体用法?C# SceneObjectPart.GetPrimType怎么用?C# SceneObjectPart.GetPrimType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectPart
的用法示例。
在下文中一共展示了SceneObjectPart.GetPrimType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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
//.........这里部分代码省略.........
示例2: GetNumberOfSides
protected int GetNumberOfSides(SceneObjectPart part)
{
int sides = part.GetNumberOfSides();
if (part.GetPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0)
{
// Make up for a bug where LSL shows 4 sides rather than 2
sides += 2;
}
return sides;
}
示例3: GetPrimParams
public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res)
{
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);
res.Add(v);
break;
case (int)ScriptBaseClass.PRIM_SIZE:
res.Add(new LSL_Vector(part.Scale));
break;
case (int)ScriptBaseClass.PRIM_ROTATION:
res.Add(GetPartRot(part));
break;
case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
res.Add(new LSL_Integer((int)part.PhysicsShapeType));
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(new LSL_String(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
res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
// hollow
res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
// twist
//.........这里部分代码省略.........
示例4: 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));
//.........这里部分代码省略.........
示例5: SitRayHorizontal
/* not in use
public void SitRayHorizontal(SceneObjectPart part)
{
// Next, try to raycast from the avatar position to fwd
Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset;
Vector3 StartRayCastPosition = CameraPosition;
Vector3 direction = EndRayCastPosition - StartRayCastPosition;
float distance = direction.Length();
direction /= distance;
m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastHorizontalResponse);
}
public void SitRayCastHorizontalResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal)
{
SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID);
if (part != null)
{
if (hitYN)
{
if (localid == m_requestedSitTargetID)
{
SitRaycastFindEdge(part,collisionPoint, normal);
m_log.DebugFormat("[SIT]: Raycast Horizontal Position succeeded at point: {0}, normal:{1}", collisionPoint, normal);
// Next, try to raycast from the camera position
Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset;
Vector3 StartRayCastPosition = CameraPosition;
Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition);
float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition);
//m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastResponseAvatarPosition);
}
else
{
ControllingClient.SendAlertMessage("Sit position not accessable.");
m_requestedSitTargetUUID = UUID.Zero;
m_requestedSitTargetID = 0;
m_requestedSitOffset = Vector3.Zero;
}
}
else
{
ControllingClient.SendAlertMessage("Sit position not accessable.");
m_requestedSitTargetUUID = UUID.Zero;
m_requestedSitTargetID = 0;
m_requestedSitOffset = Vector3.Zero;
}
}
else
{
ControllingClient.SendAlertMessage("Sit position no longer exists");
m_requestedSitTargetUUID = UUID.Zero;
m_requestedSitTargetID = 0;
m_requestedSitOffset = Vector3.Zero;
}
}
*/
private void SitRaycastFoundPath(SceneObjectPart part, Vector3 collisionPoint, Vector3 collisionNormal)
{
// go to top of part, above nearest point
Vector3 partscale = part.Scale * part.GetWorldRotation(); // part AABB
if (partscale.Z <0 )
partscale.Z = -partscale.Z;
if (part.GetPrimType() == PrimType.SPHERE)
{
Vector3 contactpos = new Vector3(0,0,partscale.Z);
SendSitResponse(m_requestedSitTargetUUID, contactpos, Quaternion.Identity);
return;
}
collisionPoint.Z += partscale.Z;
collisionNormal.Z += 0.5f;
Vector3 EndRayCastPosition = part.AbsolutePosition;
Vector3 StartRayCastPosition = collisionPoint;
Vector3 direction = EndRayCastPosition - StartRayCastPosition;
float distance = direction.Length();
direction /= distance;
m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastfindTop);
}