public void SetRotation(Quaternion newrot, Quaternion oldrot, bool editPivot) { if (EntityDef != null) { if (editPivot) { EntityDef.SetPivotOrientationFromWidget(newrot); } else { EntityDef.SetOrientationFromWidget(newrot); } } else if (CarGenerator != null) { CarGenerator.SetOrientation(newrot); } else if (ScenarioNode != null) { ScenarioNode.SetOrientation(newrot); } else if (NavPoint != null) { NavPoint.SetOrientation(newrot); } else if (NavPortal != null) { NavPortal.SetOrientation(newrot); } else if (Audio != null) { Audio.SetOrientation(newrot); } }
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q) { ScenarioNode?.SetOrientation(q); if (ScenarioNode != sel.ScenarioNode) { wf.SelectScenarioNode(ScenarioNode); } wf.SetWidgetRotation(q); //UpdateGraphics(wf); }
public void SetRotation(Quaternion newrot, bool editPivot) { if (MultipleSelectionItems != null) { if (editPivot) { } else { var cen = MultipleSelectionCenter; var orinv = Quaternion.Invert(MultipleSelectionRotation); var trans = newrot * orinv; for (int i = 0; i < MultipleSelectionItems.Length; i++) { if (MultipleSelectionItems[i].CollisionPoly == null)//skip polys, they use gathered verts { var refpos = MultipleSelectionItems[i].WidgetPosition; var relpos = refpos - cen; var newpos = trans.Multiply(relpos) + cen; var refori = MultipleSelectionItems[i].WidgetRotation; var newori = trans * refori; MultipleSelectionItems[i].SetPosition(newpos, false); MultipleSelectionItems[i].SetRotation(newori, false); } } if (GatheredCollisionVerts != null) { for (int i = 0; i < GatheredCollisionVerts.Length; i++) { var refpos = GatheredCollisionVerts[i].Position; var relpos = refpos - cen; var newpos = trans.Multiply(relpos) + cen; GatheredCollisionVerts[i].Position = newpos; } } MultipleSelectionRotation = newrot; } } else if (EntityDef != null) { if (editPivot) { EntityDef.SetPivotOrientationFromWidget(newrot); } else { EntityDef.SetOrientationFromWidget(newrot); } } else if (CarGenerator != null) { CarGenerator.SetOrientation(newrot); } else if (CollisionVertex != null) { //do nothing, but stop any poly from being rotated also } else if (CollisionPoly != null) { CollisionPoly.Orientation = newrot; } else if (CollisionBounds != null) { CollisionBounds.Orientation = newrot; } else if (ScenarioNode != null) { ScenarioNode.SetOrientation(newrot); } else if (NavPoint != null) { NavPoint.SetOrientation(newrot); } else if (NavPortal != null) { NavPortal.SetOrientation(newrot); } else if (Audio != null) { Audio.SetOrientation(newrot); } }