Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
avvy
mobile-app
Commits
66cff63c
Commit
66cff63c
authored
5 years ago
by
Sergey Paskhalov
Browse files
Options
Download
Plain Diff
Merge branch 'ScreenshotSize' into 'master'
ScreenshotSize See merge request avvy/mobile-app!55
parents
3ed6c9bf
e11da8ba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Assets/DomiDo/AvvyLand/Scripts/Editor3DObjects/BlockController/BlockMover.cs
+0
-1
...and/Scripts/Editor3DObjects/BlockController/BlockMover.cs
Assets/DomiDo/AvvyLand/Scripts/Editor3DObjects/CalculateSizeModel.cs
+16
-8
...Do/AvvyLand/Scripts/Editor3DObjects/CalculateSizeModel.cs
Assets/DomiDo/AvvyLand/Scripts/Editor3DObjects/DestroyPanelController.cs
+5
-2
...vvyLand/Scripts/Editor3DObjects/DestroyPanelController.cs
Assets/DomiDo/AvvyLand/Scripts/Editor3DObjects/MakerScreenshots.cs
+6
-10
...miDo/AvvyLand/Scripts/Editor3DObjects/MakerScreenshots.cs
with
27 additions
and
21 deletions
+27
-21
Assets/DomiDo/AvvyLand/Scripts/Editor3DObjects/BlockController/BlockMover.cs
View file @
66cff63c
...
...
@@ -95,7 +95,6 @@ namespace AvvyLand.Editor
Ray
ray
=
Camera
.
main
.
ScreenPointToRay
(
currentTouch
);
if
(
Physics
.
Raycast
(
ray
,
out
hitInfo
)
&&
hitInfo
.
collider
.
CompareTag
(
"Box"
))
{
Debug
.
Log
(
hitInfo
.
transform
.
name
);
path
=
hitInfo
.
transform
.
gameObject
.
GetComponentInParent
<
GameObjectTransformController
>().
Path
;
currentObject
=
hitInfo
.
transform
.
gameObject
;
var
entity
=
hitInfo
.
collider
.
transform
.
parent
.
GetComponent
<
GameObjectTransformController
>().
Entity
;
...
...
This diff is collapsed.
Click to expand it.
Assets/DomiDo/AvvyLand/Scripts/Editor3DObjects/CalculateSizeModel.cs
View file @
66cff63c
...
...
@@ -49,7 +49,7 @@ namespace AvvyLand.Editor.Tools
}
//update
p
rivate
void
UpdateModelSize
()
p
ublic
void
UpdateModelSize
()
{
Clear
();
ReviseStructureItems
(
projectProvider
.
Root
);
...
...
@@ -99,21 +99,29 @@ namespace AvvyLand.Editor.Tools
editorSettings
.
Structure
.
Size
=
Model
.
Structure
.
SizeModel
.
medium
;
}
structure
.
SaveStructure
(
editorSettings
.
Structure
);
Debug
.
Log
(
editorSettings
.
Structure
.
Size
.
ToString
());
}
public
float
GetDistanceCamera
(
float
cameraAngleOfView
=
60f
,
float
cameraAngleX
=
30f
)
{
var
diagonale
=
GetModelSize
();
var
dist
=
GetDistance
(
new
Vector2
(
diagonale
.
z
,
diagonale
.
x
),
cameraAngleOfView
);
var
dist2
=
GetDistance
(
new
Vector2
(
diagonale
.
y
,
diagonale
.
z
),
cameraAngleOfView
);
var
dist3
=
GetDistance
(
new
Vector2
(
diagonale
.
y
,
diagonale
.
x
),
cameraAngleOfView
);
return
Mathf
.
Max
(
dist
,
dist2
,
dist3
)
/
Mathf
.
Abs
(
Mathf
.
Cos
(
cameraAngleX
*
180
/
Mathf
.
PI
));
}
private
float
GetDistance
(
Vector2
diagonale
,
float
cameraAngleOfView
)
{
// 1) находим 2 угла прилежащих к диагонали в радианах
var
angle1
=
180
-
cameraAngleOfView
/
2
-
(
90
-
Mathf
.
Rad2Deg
*
Mathf
.
Atan
(
GetModelSize
().
z
/
GetModelSize
().
x
)
+
45
);
var
angle1
=
180
-
cameraAngleOfView
/
2
-
(
90
-
Mathf
.
Rad2Deg
*
Mathf
.
Atan
(
diagonale
.
x
/
diagonale
.
y
)
+
45
);
var
angle2
=
180
-
cameraAngleOfView
-
angle1
;
// 2) находим через теорему синусов дистанцию камеры
var
diagonale
=
GetModelSize
()
;
diagonale
.
y
=
0
;
var
dist1
=
diagonale
.
magnitude
/
2
/
Mathf
.
Sin
(
cameraAngleOfView
/
2
*
Mathf
.
Deg2Rad
)
*
Mathf
.
Sin
(
angle1
*
Mathf
.
Deg2Rad
);
var
dist2
=
diagonale
.
magnitude
/
2
/
Mathf
.
Sin
(
cameraAngleOfView
/
2
*
Mathf
.
Deg2Rad
)
*
Mathf
.
Sin
(
angle2
*
Mathf
.
Deg2Rad
);
var
dist1
=
diagonale
.
magnitude
/
Mathf
.
Sin
(
cameraAngleOfView
/
2
*
Mathf
.
Deg2Rad
)
*
Mathf
.
Sin
(
angle1
*
Mathf
.
Deg2Rad
);
var
dist2
=
diagonale
.
magnitude
/
Mathf
.
Sin
(
cameraAngleOfView
/
2
*
Mathf
.
Deg2Rad
)
*
Mathf
.
Sin
(
angle2
*
Mathf
.
Deg2Rad
);
// 3) берем наибольшую дистанцию и учитываем высоту
return
Mathf
.
Max
(
dist1
,
dist2
)
/
Mathf
.
Abs
(
Mathf
.
Cos
(
cameraAngleX
*
180
/
Mathf
.
PI
));
return
Mathf
.
Max
(
dist1
,
dist2
)
;
/
/
}
public
void
Clear
()
...
...
This diff is collapsed.
Click to expand it.
Assets/DomiDo/AvvyLand/Scripts/Editor3DObjects/DestroyPanelController.cs
View file @
66cff63c
...
...
@@ -82,8 +82,11 @@ public class DestroyPanelController : MonoBehaviour, IPointerEnterHandler, IPoin
{
if
(!
IsActive
)
{
animator
.
Play
(
"Activate"
);
IsActive
=
true
;
if
(
animator
!=
null
)
{
animator
.
Play
(
"Activate"
);
IsActive
=
true
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Assets/DomiDo/AvvyLand/Scripts/Editor3DObjects/MakerScreenshots.cs
View file @
66cff63c
...
...
@@ -12,7 +12,7 @@ namespace AvvyLand.Editor
public
class
MakerScreenshots
{
private
Camera
screenshotCamera
;
private
float
koefDistance
=
2
.1f
;
private
float
koefDistance
=
1
.1f
;
private
CalculateSizeModel
calculateSize
;
private
FirebaseStorageAPI
storage
;
private
ICoroutineProvider
coroutineProvider
;
...
...
@@ -21,9 +21,6 @@ namespace AvvyLand.Editor
private
Texture2D
screenshot
=
new
Texture2D
(
Screen
.
width
,
Screen
.
height
);
private
const
float
time
=
10f
;
private
float
timer
=
1
;
private
float
distance
;
private
List
<
byte
[
]>
images
=
new
List
<
byte
[
]>
();
...
...
@@ -43,15 +40,13 @@ namespace AvvyLand.Editor
{
while
(
true
)
{
yield
return
new
WaitForSeconds
(
time
r
);
yield
return
new
WaitForSeconds
(
time
);
images
.
Clear
();
for
(
int
i
=
1
;
i
<=
8
;
i
++)
{
ChangePositionCamera
();
yield
return
coroutineProvider
.
StartCoroutine
(
CreateScreenshots
());
}
timer
=
time
;
//SaveScreenshots();
}
}
...
...
@@ -65,11 +60,12 @@ namespace AvvyLand.Editor
private
void
ChangePositionCamera
()
{
if
(
distance
==
0
)
var
distance
=
calculateSize
.
GetDistanceCamera
(
screenshotCamera
.
fieldOfView
,
screenshotCamera
.
transform
.
eulerAngles
.
x
);
screenshotCamera
.
transform
.
eulerAngles
+=
new
Vector3
(
0
,
45
,
0
);
if
(
calculateSize
.
GetGeomCenterModel
()
==
Vector3
.
zero
)
{
distance
=
calculateSize
.
GetDistanceCamera
(
screenshotCamera
.
fieldOfView
,
screenshotCamera
.
transform
.
eulerAngles
.
x
);
calculateSize
.
UpdateModelSize
(
);
}
screenshotCamera
.
transform
.
eulerAngles
+=
new
Vector3
(
0
,
45
,
0
);
screenshotCamera
.
transform
.
position
=
calculateSize
.
GetGeomCenterModel
()
-
screenshotCamera
.
transform
.
forward
*
distance
*
koefDistance
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help