public void Bake() { //Group.Blueprint = GetGamedataFile.FixMapsPath(Group.Blueprint.Replace("\\", "/")); BlueprintPath = Group.Blueprint.Replace("\\", "/"); if (!BlueprintPath.StartsWith("/")) { BlueprintPath = "/" + BlueprintPath; } BlueprintPath = GetGamedataFile.FixMapsPath(BlueprintPath); Position = ScmapEditor.WorldPosToScmap(Obj.Tr.position); RotationX = Vector3.zero; RotationY = Vector3.zero; RotationZ = Vector3.zero; MassMath.QuaternionToRotationMatrix(Obj.Tr.localRotation, ref RotationX, ref RotationY, ref RotationZ); Scale = Obj.Tr.localScale; if (Group.PropObject.BP != null) { Scale.x /= Group.PropObject.BP.LocalScale.x; Scale.y /= Group.PropObject.BP.LocalScale.y; Scale.z /= Group.PropObject.BP.LocalScale.z; } }
public void CreateObject(bool AllowFarLod = true) { Obj = Group.PropObject.CreatePropGameObject( ScmapEditor.ScmapPosToWorld(Position), MassMath.QuaternionFromRotationMatrix(RotationX, RotationY, RotationZ), Scale, AllowFarLod ); Obj.Connected = this; }
void ControlerDragRotateY() { if (!Draged) { UndoRegisterMove(); Draged = true; } Ray ray = CameraControler.Current.Cam.ScreenPointToRay(Input.mousePosition); Vector3 NewPos = PosOnControler(ray); //Vector3 Offset = NewPos - ControlerClickPoint; float Angle = MassMath.AngleSigned(ControlerClickPoint - Controls.localPosition, NewPos - Controls.localPosition, Vector3.up); if (MinAngle > 0) { Angle += 180; Angle = (int)(Angle / MinAngle) * MinAngle; Angle -= 180; } Quaternion Rot = Quaternion.Euler(Vector3.up * Angle); Quaternion RotInverse = Quaternion.Euler(Vector3.down * Angle); Controls.localRotation = Rot * ControlerBeginRot; Selection.OffsetRotation(Controls.position, Rot); for (int i = 0; i < SymetrySelection.Length; i++) { if (SymetrySelection[i].InverseRotation) { SymetrySelection[i].OffsetRotation(Controls.position, RotInverse); } else { SymetrySelection[i].OffsetRotation(Controls.position, Rot); } } }
void UpdateSymmetryObjects() { Vector3 Euler = PlacementObject.transform.localRotation.eulerAngles; for (int i = 0; i < PlacementSymmetry.Length; i++) { Vector3 SymmetryPoint = SymmetryMatrix[i].MultiplyPoint(PlacementObject.transform.position - MapLuaParser.Current.MapCenterPoint) + MapLuaParser.Current.MapCenterPoint; PlacementSymmetry[i].transform.localPosition = SymmetryPoint; PlacementSymmetry[i].transform.localRotation = Quaternion.Euler(new Vector3(Euler.x, Euler.y * (InvertRotation[i] ? (-1) : (1)), Euler.z)) * MassMath.QuaternionFromMatrix(SymmetryMatrix[i]); PlacementSymmetry[i].transform.localScale = PlacementObject.transform.localScale; } }