public UpdateRotation ( Quaternion rot ) : void | ||
rot | Quaternion | |
Результат | void |
public void PlaybackState(SceneObjectPart part) { if (part != null) { part.Undoing = true; if (part.ParentID == 0) { if (Position != Vector3.Zero) { part.ParentGroup.AbsolutePosition = Position; } part.RotationOffset = Rotation; if (Scale != Vector3.Zero) { part.Scale = Scale; } lock (part.ParentGroup.Children) { foreach (SceneObjectPart child in part.ParentGroup.Children.Values.Where(child => child.UUID != part.UUID)) { child.Undo(); //No updates here, child undo will do it on their own } } } else { if (Position != Vector3.Zero) { part.OffsetPosition = Position; } part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) { part.Resize(Scale); } } part.Undoing = false; part.ScheduleFullUpdate(); } }
protected void SetRot(SceneObjectPart part, Quaternion rot) { part.UpdateRotation(rot); // Update rotation does not move the object in the physics scene if it's a linkset. //KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type // part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt // It's perfectly okay when the object is not an active physical body though. // So, part.ParentGroup.ResetChildPrimPhysicsPositions(); does the thing that Kitto is warning against // but only if the object is not physial and active. This is important for rotating doors. // without the absoluteposition = absoluteposition happening, the doors do not move in the physics // scene PhysicsActor pa = part.PhysActor; if (pa != null && !pa.IsPhysical) { part.ParentGroup.ResetChildPrimPhysicsPositions(); } }
protected void SetRot(SceneObjectPart part, Quaternion rot) { part.UpdateRotation(rot); // Update rotation does not move the object in the physics scene if it's a linkset. part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; }
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)); } }
public void PlaybackState(SceneObjectPart part) { if (part != null) { part.Undoing = true; if (part.ParentID == 0) { part.ParentGroup.AbsolutePosition = Position; part.UpdateRotation(Rotation); part.ParentGroup.ScheduleGroupForTerseUpdate(); } else { part.OffsetPosition = Position; part.UpdateRotation(Rotation); part.Resize(Scale); part.ScheduleTerseUpdate(); } part.Undoing = false; } }
public void doChangeObject(SceneObjectPart part, ObjectChangeData data) { // TODO this still as excessive *.Schedule*Update()s if (part != null && part.ParentGroup != null) { ObjectChangeType change = data.change; bool togroup = ((change & ObjectChangeType.Group) != 0); // bool uniform = ((what & ObjectChangeType.UniformScale) != 0); not in use SceneObjectGroup group = part.ParentGroup; PhysicsActor pha = group.RootPart.PhysActor; updatetype updateType = updatetype.none; if (togroup) { // related to group if ((change & (ObjectChangeType.Rotation | ObjectChangeType.Position)) != 0) { if ((change & ObjectChangeType.Rotation) != 0) { group.RootPart.UpdateRotation(data.rotation); updateType = updatetype.none; } if ((change & ObjectChangeType.Position) != 0) { if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position)) UpdateGroupPosition(data.position); updateType = updatetype.groupterse; } else // ugly rotation update of all parts { group.ResetChildPrimPhysicsPositions(); } } if ((change & ObjectChangeType.Scale) != 0) { if (pha != null) pha.Building = true; group.GroupResize(data.scale); updateType = updatetype.none; if (pha != null) pha.Building = false; } } else { // related to single prim in a link-set ( ie group) if (pha != null) pha.Building = true; // root part is special // parts offset positions or rotations need to change also if (part == group.RootPart) { if ((change & ObjectChangeType.Rotation) != 0) group.UpdateRootRotation(data.rotation); if ((change & ObjectChangeType.Position) != 0) group.UpdateRootPosition(data.position); if ((change & ObjectChangeType.Scale) != 0) part.Resize(data.scale); } else { if ((change & ObjectChangeType.Position) != 0) { part.OffsetPosition = data.position; updateType = updatetype.partterse; } if ((change & ObjectChangeType.Rotation) != 0) { part.UpdateRotation(data.rotation); updateType = updatetype.none; } if ((change & ObjectChangeType.Scale) != 0) { part.Resize(data.scale); updateType = updatetype.none; } } if (pha != null) pha.Building = false; } if (updateType != updatetype.none) { group.HasGroupChanged = true; switch (updateType) { case updatetype.partterse: part.ScheduleTerseUpdate(); break; case updatetype.partfull: part.ScheduleFullUpdate(); break; case updatetype.groupterse: group.ScheduleGroupForTerseUpdate(); break; case updatetype.groupfull: group.ScheduleGroupForFullUpdate(); break; default: break; } } } }
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; } }
protected void SetRot(SceneObjectPart part, Quaternion rot) { if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) return; bool isroot = (part == part.ParentGroup.RootPart); bool isphys; PhysicsActor pa = part.PhysActor; // keep using physactor ideia of isphysical // it should be SOP ideia of that // not much of a issue with ubOde if (pa != null && pa.IsPhysical) isphys = true; else isphys = false; // SL doesn't let scripts rotate root of physical linksets if (isroot && isphys) return; part.UpdateRotation(rot); // Update rotation does not move the object in the physics engine if it's a non physical linkset // so do a nasty update of parts positions if is a root part rotation if (isroot && pa != null) // with if above implies non physical root part { part.ParentGroup.ResetChildPrimPhysicsPositions(); } else // fix sitting avatars. This is only needed bc of how we link avas to child parts, not root part { // List<ScenePresence> sittingavas = part.ParentGroup.GetLinkedAvatars(); List<ScenePresence> sittingavas = part.ParentGroup.GetSittingAvatars(); if (sittingavas.Count > 0) { foreach (ScenePresence av in sittingavas) { if (isroot || part.LocalId == av.ParentID) av.SendTerseUpdateToAllClients(); } } } }
public void PlayfwdState(SceneObjectPart part) { part.Undoing = true; if (part.ParentID == 0) { if (Position != Vector3.Zero) part.ParentGroup.AbsolutePosition = Position; if (Rotation != Quaternion.Identity) part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) { if (ForGroup) part.ParentGroup.GroupResize(Scale); else part.Resize(Scale); } part.ParentGroup.ScheduleGroupForTerseUpdate(); } else { // Note: Updating these properties on sop automatically schedules an update if needed if (Position != Vector3.Zero) part.OffsetPosition = Position; if (Rotation != Quaternion.Identity) part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) part.Resize(Scale); } part.Undoing = false; }
public void PlayfwdState(SceneObjectPart part) { if (part != null) { part.Undoing = true; if (part.ParentID == 0) { if (Position != Vector3.Zero) part.ParentGroup.AbsolutePosition = Position; if (Rotation != Quaternion.Identity) part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) part.Resize(Scale); part.ParentGroup.ScheduleGroupForTerseUpdate(); } else { if (Position != Vector3.Zero) part.OffsetPosition = Position; if (Rotation != Quaternion.Identity) part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) part.Resize(Scale); part.ScheduleTerseUpdate(); } part.Undoing = false; } }
public void PlaybackState(SceneObjectPart part) { part.Undoing = true; if (part.ParentID == 0) { // m_log.DebugFormat( // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", // Position, part.Name, part.LocalId); if (Position != Vector3.Zero) { if (ForGroup) part.ParentGroup.AbsolutePosition = Position; else part.ParentGroup.UpdateRootPosition(Position); } // m_log.DebugFormat( // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", // part.RotationOffset, Rotation, part.Name, part.LocalId); if (ForGroup) part.UpdateRotation(Rotation); else part.ParentGroup.UpdateRootRotation(Rotation); if (Scale != Vector3.Zero) { // m_log.DebugFormat( // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", // part.Shape.Scale, Scale, part.Name, part.LocalId); if (ForGroup) part.ParentGroup.GroupResize(Scale); else part.Resize(Scale); } part.ParentGroup.ScheduleGroupForTerseUpdate(); } else { // Note: Updating these properties on sop automatically schedules an update if needed if (Position != Vector3.Zero) { // m_log.DebugFormat( // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", // part.OffsetPosition, Position, part.Name, part.LocalId); part.OffsetPosition = Position; } // m_log.DebugFormat( // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", // part.RotationOffset, Rotation, part.Name, part.LocalId); part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) { // m_log.DebugFormat( // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", // part.Shape.Scale, Scale, part.Name, part.LocalId); part.Resize(Scale); } } part.Undoing = false; }
public void PlayfwdState(SceneObjectPart part) { if (part != null) { part.Undoing = true; bool ChangedScale = false; bool ChangedRot = false; bool ChangedPos = false; if (part.ParentID == 0) { if (Position != Vector3.Zero) { ChangedPos = true; part.ParentGroup.AbsolutePosition = Position; } ChangedRot = true; part.RotationOffset = Rotation; if (Scale != Vector3.Zero) { ChangedScale = true; part.Scale = Scale; } lock (part.ParentGroup.Children) { foreach (SceneObjectPart child in part.ParentGroup.Children.Values.Where(child => 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.OffsetPosition = Position; } ChangedRot = true; part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) { ChangedScale = true; part.Resize(Scale); } } part.Undoing = false; part.ScheduleFullUpdate(); //part.ScheduleUpdate((ChangedScale ? PrimUpdateFlags.Shape : PrimUpdateFlags.None) | // (ChangedPos ? PrimUpdateFlags.Position : PrimUpdateFlags.None) | // (ChangedRot ? PrimUpdateFlags.Rotation : PrimUpdateFlags.None)); } }
private void SetRotation(SceneObjectPart part, Quaternion rot) { part.UpdateRotation(Rotate(rot)); part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; }
protected void SetRot(SceneObjectPart part, Quaternion rot) { part.UpdateRotation(rot); // Update rotation does not move the object in the physics scene if it's a linkset. //KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type // part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; }
public void PlayfwdState(SceneObjectPart part) { if (part != null) { part.Undoing = true; if (part.ParentID == 0) { if (Position != Vector3.Zero) { part.ParentGroup.AbsolutePosition = Position; } part.RotationOffset = Rotation; if (Scale != Vector3.Zero) { part.Scale = Scale; } foreach (SceneObjectPart child in part.ParentGroup.GetParts().Where(child => child.UUID != part.UUID)) { child.Redo(); //No updates here, child redo will do it on their own } } else { if (Position != Vector3.Zero) { part.OffsetPosition = Position; } part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) { part.Resize(Scale); } } part.Undoing = false; part.ScheduleFullUpdate(PrimUpdateFlags.FindBest); } }