本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectPart.FixOffsetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectPart.FixOffsetPosition方法的具体用法?C# SceneObjectPart.FixOffsetPosition怎么用?C# SceneObjectPart.FixOffsetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.SceneObjectPart
的用法示例。
在下文中一共展示了SceneObjectPart.FixOffsetPosition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DelinkFromGroup
/// <summary>
/// Delink the given prim from this group. The delinked prim is established as
/// an independent SceneObjectGroup.
/// </summary>
/// <param name="partID"></param>
/// <param name="sendEvents"></param>
/// <returns>The object group of the newly delinked prim.</returns>
public SceneObjectGroup DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
{
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
Quaternion worldRot = linkPart.GetWorldRotation();
// Remove the part from this object
m_scene.SceneGraph.DeLinkPartFromEntity(this, linkPart);
/* this is already done in DeLinkPartFromEntity
if (m_partsList.Count == 1 && RootPart != null) //Single prim is left
RootPart.LinkNum = 0;
else
{
lock (m_partsLock)
{
foreach (SceneObjectPart p in m_partsList)
{
if (p.LinkNum > linkPart.LinkNum)
p.LinkNum--;
}
}
}
*/
linkPart.SetParentLocalId(0);
linkPart.LinkNum = 0;
if (linkPart.PhysActor != null)
{
m_scene.SceneGraph.PhysicsScene.RemovePrim(linkPart.PhysActor);
// linkPart.PhysActor.delink();
}
// We need to reset the child part's position
// ready for life as a separate object after being a part of another object
Quaternion parentRot = m_rootPart.RotationOffset;
Vector3 axPos = linkPart.OffsetPosition;
axPos *= parentRot;
linkPart.SetOffsetPosition(axPos);
linkPart.FixGroupPosition(AbsolutePosition + linkPart.OffsetPosition,false);
linkPart.FixOffsetPosition(Vector3.Zero, false);
linkPart.RotationOffset = worldRot;
SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart, Scene);
m_scene.SceneGraph.DelinkPartToScene(objectGroup);
if (sendEvents)
linkPart.TriggerScriptChangedEvent(Changed.LINK);
linkPart.Rezzed = RootPart.Rezzed;
//This is already set multiple places, no need to do it again
//HasGroupChanged = true;
//We need to send this so that we don't have issues with the client not realizing that the prims were unlinked
ScheduleGroupUpdate(PrimUpdateFlags.FullUpdate);
return objectGroup;
}
示例2: BuildPrim
//.........这里部分代码省略.........
break;
case "PathBegin":
s.PathBegin = Convert.ToUInt16(o[i]);
break;
case "PathEnd":
s.PathEnd = Convert.ToUInt16(o[i]);
break;
case "PathScaleX":
s.PathScaleX = Convert.ToByte(o[i]);
break;
case "PathScaleY":
s.PathScaleY = Convert.ToByte(o[i]);
break;
case "PathShearX":
s.PathShearX = Convert.ToByte(o[i]);
break;
case "PathShearY":
s.PathShearY = Convert.ToByte(o[i]);
break;
case "PathSkew":
s.PathSkew = Convert.ToSByte(o[i]);
break;
case "PathCurve":
s.PathCurve = Convert.ToByte(o[i]);
break;
case "PathRadiusOffset":
s.PathRadiusOffset = Convert.ToSByte(o[i]);
break;
case "PathRevolutions":
s.PathRevolutions = Convert.ToByte(o[i]);
break;
case "PathTaperX":
s.PathTaperX = Convert.ToSByte(o[i]);
break;
case "PathTaperY":
s.PathTaperY = Convert.ToSByte(o[i]);
break;
case "PathTwist":
s.PathTwist = Convert.ToSByte(o[i]);
break;
case "PathTwistBegin":
s.PathTwistBegin = Convert.ToSByte(o[i]);
break;
case "ProfileBegin":
s.ProfileBegin = Convert.ToUInt16(o[i]);
break;
case "ProfileEnd":
s.ProfileEnd = Convert.ToUInt16(o[i]);
break;
case "ProfileCurve":
s.ProfileCurve = Convert.ToByte(o[i]);
break;
case "ProfileHollow":
s.ProfileHollow = Convert.ToUInt16(o[i]);
break;
case "State":
s.State = Convert.ToByte(o[i]);
break;
case "Texture":
byte[] textureEntry = (byte[])o[i];
s.TextureEntry = textureEntry;
break;
case "ExtraParams":
s.ExtraParams = (byte[])o[i];
break;
case "Media":
if (!(o[i] is System.DBNull))
s.Media = PrimitiveBaseShape.MediaList.FromXml((string)o[i]);
break;
default:
m_log.Warn("[MySQL]: Unknown database row: " + name);
break;
}
#endregion
}
}
catch(Exception ex)
{
m_log.Warn("[MySQL]: Exception loading a SceneObject, " + ex.ToString() + ", deleting..");
this.RemoveObject(prim.UUID, UUID.Zero);
}
s.Scale = new Vector3(ScaleX, ScaleY, ScaleZ);
prim.Shape = s;
prim.SoundFlags = 1; // If it's persisted at all, it's looped
prim.Color = Color.FromArgb(ColorA, ColorR, ColorG, ColorB);
prim.FixOffsetPosition(new Vector3(PositionX, PositionY, PositionZ),true);
prim.FixGroupPosition( new Vector3(GroupPositionX, GroupPositionY, GroupPositionZ),true);
prim.Velocity = new Vector3(VelocityX, VelocityY, VelocityZ);
prim.AngularVelocity = new Vector3(AngularVelocityX, AngularVelocityY, AngularVelocityZ);
prim.RotationOffset = new Quaternion(RotationX, RotationY, RotationZ, RotationW);
prim.SitTargetPositionLL = new Vector3(SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ);
prim.SitTargetOrientationLL = new Quaternion(SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, SitTargetOrientW);
prim.AngularVelocity = new Vector3(OmegaX, OmegaY, OmegaZ);
prim.CameraEyeOffset = new Vector3(CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ);
prim.CameraAtOffset = new Vector3(CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ);
return prim;
}
示例3: BuildPrim
/// <summary>
/// Builds the prim from a datarecord.
/// </summary>
/// <param name="primRow">datarecord</param>
/// <returns></returns>
private static SceneObjectPart BuildPrim(IDataRecord primRow, IScene scene)
{
SceneObjectPart prim = new SceneObjectPart(scene);
prim.UUID = new UUID((Guid)primRow["UUID"]);
// explicit conversion of integers is required, which sort
// of sucks. No idea if there is a shortcut here or not.
prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]);
prim.Name = (string)primRow["Name"];
// various text fields
prim.Text = (string)primRow["Text"];
prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]),
Convert.ToInt32(primRow["ColorR"]),
Convert.ToInt32(primRow["ColorG"]),
Convert.ToInt32(primRow["ColorB"]));
prim.Description = (string)primRow["Description"];
prim.SitName = (string)primRow["SitName"];
prim.TouchName = (string)primRow["TouchName"];
// permissions
prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]);
prim.CreatorID = new UUID((Guid)primRow["CreatorID"]);
prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
prim.GroupID = new UUID((Guid)primRow["GroupID"]);
prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
prim.EveryoneMask = Convert.ToUInt32(primRow["EveryoneMask"]);
prim.BaseMask = Convert.ToUInt32(primRow["BaseMask"]);
// vectors
prim.FixOffsetPosition ( new Vector3(
Convert.ToSingle(primRow["PositionX"]),
Convert.ToSingle(primRow["PositionY"]),
Convert.ToSingle(primRow["PositionZ"]))
,true);
prim.FixGroupPosition (new Vector3(
Convert.ToSingle(primRow["GroupPositionX"]),
Convert.ToSingle(primRow["GroupPositionY"]),
Convert.ToSingle(primRow["GroupPositionZ"]))
,true);
prim.Velocity = new Vector3(
Convert.ToSingle(primRow["VelocityX"]),
Convert.ToSingle(primRow["VelocityY"]),
Convert.ToSingle(primRow["VelocityZ"]));
prim.AngularVelocity = new Vector3(
Convert.ToSingle(primRow["AngularVelocityX"]),
Convert.ToSingle(primRow["AngularVelocityY"]),
Convert.ToSingle(primRow["AngularVelocityZ"]));
prim.Acceleration = new Vector3(
Convert.ToSingle(primRow["AccelerationX"]),
Convert.ToSingle(primRow["AccelerationY"]),
Convert.ToSingle(primRow["AccelerationZ"]));
// quaternions
prim.RotationOffset = new Quaternion(
Convert.ToSingle(primRow["RotationX"]),
Convert.ToSingle(primRow["RotationY"]),
Convert.ToSingle(primRow["RotationZ"]),
Convert.ToSingle(primRow["RotationW"]));
prim.SitTargetPositionLL = new Vector3(
Convert.ToSingle(primRow["SitTargetOffsetX"]),
Convert.ToSingle(primRow["SitTargetOffsetY"]),
Convert.ToSingle(primRow["SitTargetOffsetZ"]));
prim.SitTargetOrientationLL = new Quaternion(
Convert.ToSingle(primRow["SitTargetOrientX"]),
Convert.ToSingle(primRow["SitTargetOrientY"]),
Convert.ToSingle(primRow["SitTargetOrientZ"]),
Convert.ToSingle(primRow["SitTargetOrientW"]));
prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]);
prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]);
prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]);
prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]);
prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]);
prim.Sound = new UUID((Guid)primRow["LoopedSound"]);
prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]);
prim.SoundFlags = 1; // If it's persisted at all, it's looped
if (!(primRow["TextureAnimation"] is DBNull))
prim.TextureAnimation = (Byte[])primRow["TextureAnimation"];
if (!(primRow["ParticleSystem"] is DBNull))
prim.ParticleSystem = (Byte[])primRow["ParticleSystem"];
prim.AngularVelocity = new Vector3(
Convert.ToSingle(primRow["OmegaX"]),
Convert.ToSingle(primRow["OmegaY"]),
Convert.ToSingle(primRow["OmegaZ"]));
//.........这里部分代码省略.........
示例4: ProcessOffsetPosition
private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader)
{
obj.FixOffsetPosition(ReadVector(reader, "OffsetPosition"),true);
}
示例5: SetPos
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
{
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
LSL_Vector currentPos = GetPartLocalPos(part);
float ground = 0;
bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
ITerrainChannel heightmap = World.RequestModuleInterface<ITerrainChannel>();
if(heightmap != null)
ground = heightmap.GetNormalizedGroundHeight((float)targetPos.x, (float)targetPos.y);
if (part.ParentGroup == null)
{
if (ground != 0 && (targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0)
targetPos.z = ground;
LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z));
}
else if (part.ParentGroup.RootPart == part)
{
SceneObjectGroup parent = part.ParentGroup;
if (!part.IsAttachment)
{
if (ground != 0 && (targetPos.z < ground) && disable_underground_movement)
targetPos.z = ground;
}
LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
parent.UpdateGroupPosition(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z), true);
}
else
{
LSL_Vector rel_vec = SetPosAdjust(currentPos, targetPos);
part.FixOffsetPosition((new Vector3((float)rel_vec.x, (float)rel_vec.y, (float)rel_vec.z)),true);
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupTerseUpdate();
}
}
示例6: PlaybackState
public void PlaybackState(SceneObjectPart part)
{
if (part != null)
{
part.Undoing = true;
bool ChangedScale = false;
bool ChangedRot = false;
bool ChangedPos = false;
if (part.UUID == part.ParentGroup.UUID)
{
if (Position != Vector3.Zero)
{
ChangedPos = true;
part.ParentGroup.AbsolutePosition = Position;
}
ChangedRot = true;
part.RotationOffset = Rotation;
if (Scale != Vector3.Zero)
{
ChangedScale = true;
part.Scale = Scale;
}
#if (!ISWIN)
foreach (SceneObjectPart child in part.ParentGroup.ChildrenList)
{
if (child.UUID != part.UUID)
{
child.Undo(); //No updates here, child undo will do it on their own
}
}
#else
foreach (SceneObjectPart child in part.ParentGroup.ChildrenList.Where(child => child.UUID != part.UUID))
{
child.Undo(); //No updates here, child undo will do it on their own
}
#endif
}
else
{
if (Position != Vector3.Zero)
{
ChangedPos = true;
part.FixOffsetPosition(Position, false);
}
ChangedRot = true;
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
{
ChangedScale = true;
part.Resize(Scale);
}
}
part.Undoing = false;
part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
(ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
(ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
}
}
示例7: buildPrim
//.........这里部分代码省略.........
break;
case "OmegaX":
OmegaX = Convert.ToSingle(o[i].ToString());
break;
case "OmegaY":
OmegaY = Convert.ToSingle(o[i].ToString());
break;
case "OmegaZ":
OmegaZ = Convert.ToSingle(o[i].ToString());
break;
case "CameraEyeOffsetX":
CameraEyeOffsetX = Convert.ToSingle(o[i].ToString());
break;
case "CameraEyeOffsetY":
CameraEyeOffsetY = Convert.ToSingle(o[i].ToString());
break;
case "CameraEyeOffsetZ":
CameraEyeOffsetZ = Convert.ToSingle(o[i].ToString());
break;
case "CameraAtOffsetX":
CameraAtOffsetX = Convert.ToSingle(o[i].ToString());
break;
case "CameraAtOffsetY":
CameraAtOffsetY = Convert.ToSingle(o[i].ToString());
break;
case "CameraAtOffsetZ":
CameraAtOffsetZ = Convert.ToSingle(o[i].ToString());
break;
case "ForceMouselook":
prim.ForceMouselook = Convert.ToInt32(o[i].ToString()) != 0;
break;
case "ScriptAccessPin":
prim.ScriptAccessPin = Convert.ToInt32(o[i].ToString());
break;
case "AllowedDrop":
prim.AllowedDrop = Convert.ToInt32(o[i].ToString()) != 0;
break;
case "DieAtEdge":
prim.DIE_AT_EDGE = Convert.ToInt32(o[i].ToString()) != 0;
break;
case "SalePrice":
prim.SalePrice = Convert.ToInt32(o[i].ToString());
break;
case "SaleType":
prim.ObjectSaleType = Convert.ToByte(o[i].ToString());
break;
case "Material":
prim.Material = Convert.ToByte(o[i].ToString());
break;
case "ClickAction":
if (!(row[i] is DBNull))
prim.ClickAction = Convert.ToByte(o[i].ToString());
break;
case "CollisionSound":
prim.CollisionSound = new UUID(o[i].ToString());
break;
case "CollisionSoundVolume":
prim.CollisionSoundVolume = Convert.ToSingle(o[i].ToString());
break;
case "PassTouches":
prim.PassTouch = (int)Convert.ToSingle(o[i].ToString());
break;
case "VolumeDetect":
if(!(row[i] is DBNull))
prim.VolumeDetectActive = Convert.ToInt32(o[i].ToString()) == 1;
break;
case "LinkNumber":
prim.LinkNum = int.Parse(o[i].ToString());
break;
case "Generic":
prim.GenericData = o[i].ToString();
break;
case "SceneGroupID":
break;
case "RegionUUID":
break;
default:
m_log.Warn("[NXGSQLite]: Unknown database row: " + name);
break;
}
#endregion
}
prim.SoundFlags = 1; // If it's persisted at all, it's looped
prim.Color = Color.FromArgb(ColorA, ColorR, ColorG, ColorB);
prim.FixOffsetPosition ( new Vector3(PositionX, PositionY, PositionZ),true);
prim.FixGroupPosition(new Vector3(GroupPositionX, GroupPositionY, GroupPositionZ),true);
prim.Velocity = new Vector3(VelocityX, VelocityY, VelocityZ);
prim.AngularVelocity = new Vector3(AngularVelocityX, AngularVelocityY, AngularVelocityZ);
prim.RotationOffset = new Quaternion(RotationX, RotationY, RotationZ, RotationW);
prim.SitTargetPositionLL = new Vector3(SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ);
prim.SitTargetOrientationLL = new Quaternion(SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, SitTargetOrientW);
prim.AngularVelocity = new Vector3(OmegaX, OmegaY, OmegaZ);
prim.CameraEyeOffset = new Vector3(CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ);
prim.CameraAtOffset = new Vector3 (CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ);
prim.Acceleration = new Vector3 (AccelerationX, AccelerationY, AccelerationZ);
return prim;
}
示例8: PlayfwdState
public void PlayfwdState(SceneObjectPart part)
{
if (part != null)
{
bool ChangedScale = false;
bool ChangedRot = false;
bool ChangedPos = false;
part.Undoing = true;
if (part.UUID == part.ParentGroup.UUID)
{
if (Position != Vector3.Zero)
{
ChangedPos = true;
part.ParentGroup.AbsolutePosition = Position;
}
if (Rotation != Quaternion.Identity)
{
ChangedRot = true;
part.UpdateRotation(Rotation);
}
if (Scale != Vector3.Zero)
{
ChangedScale = true;
part.Resize(Scale);
}
foreach (SceneObjectPart child in part.ParentGroup.ChildrenList)
{
if (child.UUID != part.UUID)
child.Redo(); //No updates here, child redo will do it on their own
}
}
else
{
if (Position != Vector3.Zero)
{
ChangedPos = true;
part.FixOffsetPosition(Position,false);
}
if (Rotation != Quaternion.Identity)
{
ChangedRot = true;
part.ParentGroup.Rotation = (Rotation);
}
if (Scale != Vector3.Zero)
{
ChangedScale = true;
part.Resize(Scale);
}
}
part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) |
(ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) |
(ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None));
part.Undoing = false;
}
}