Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StockRunning
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
czy
StockRunning
Commits
fd52e284
Commit
fd52e284
authored
Apr 23, 2021
by
czy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
控制摄像机旋转角度
parent
07371ab7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
FollowTarget.cs
StockRunning/Assets/#A2_Scripts/Camera/FollowTarget.cs
+9
-2
Level2My.prefab
StockRunning/Assets/Prefabs/Level2My.prefab
+3
-3
No files found.
StockRunning/Assets/#A2_Scripts/Camera/FollowTarget.cs
View file @
fd52e284
...
...
@@ -34,8 +34,11 @@ public class FollowTarget : MonoBehaviour
public
float
backDis
=
5.51f
;
public
float
upDis
=
8.77f
;
//[Tooltip("控制摄像机开始的旋转角度")]
//public Vector3 StartRotation;
[
Tooltip
(
"控制摄像机的旋转角度"
)]
public
Vector3
rotationVector3
;
private
Vector3
tt
;
//public float smood=10;
public
Transform
target
;
...
...
@@ -44,13 +47,15 @@ public class FollowTarget : MonoBehaviour
{
//target = GameObject.FindGameObjectWithTag("Player").transform;
//target.position = new Vector3(0,target.position.y,target.position.z);//摄像机不左右看。
//transform.rotation = Quaternion.Euler(StartRotation.x, StartRotation.y, StartRotation.z);
}
private
void
LateUpdate
()
{
rotationVector3
=
ConfigurationFile
.
instance
.
rotationVector3MainCamera
;
//读取配置文件数据
backDis
=
ConfigurationFile
.
instance
.
backDis
;
upDis
=
ConfigurationFile
.
instance
.
upDis
;
...
...
@@ -62,8 +67,10 @@ public class FollowTarget : MonoBehaviour
Vector3
followPoint
=
new
Vector3
(
0
,
0
,
target
.
position
.
z
)
+
Vector3
.
up
*
upDis
-
target
.
forward
*
backDis
;
//照相机不左右移动
transform
.
position
=
followPoint
;
//
选择
//
旋转
//transform.Rotate(RotateVector3); //在update中将会一直旋转
//Vector3 temp = Vector3.Lerp(transform.rotation.eulerAngles, rotationVector3, 0.01f);
transform
.
rotation
=
Quaternion
.
Euler
(
rotationVector3
.
x
,
rotationVector3
.
y
,
rotationVector3
.
z
);
...
...
StockRunning/Assets/Prefabs/Level2My.prefab
View file @
fd52e284
...
...
@@ -2023,8 +2023,7 @@ Transform:
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
3837569216442705610
}
m_LocalRotation
:
{
x
:
0.17364818
,
y
:
-0.0000000037252903
,
z
:
-0.0000000018626451
,
w
:
0.9848078
}
m_LocalRotation
:
{
x
:
0.17364816
,
y
:
0
,
z
:
0
,
w
:
0.9848078
}
m_LocalPosition
:
{
x
:
0
,
y
:
7.659995
,
z
:
-54.489998
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
...
...
@@ -2104,7 +2103,8 @@ MonoBehaviour:
m_EditorClassIdentifier
:
backDis
:
6.390015
upDis
:
6.64
RotateVector3
:
{
x
:
20
,
y
:
0
,
z
:
0
}
StartRotation
:
{
x
:
-29.62
,
y
:
0
,
z
:
0
}
rotationVector3
:
{
x
:
20
,
y
:
0
,
z
:
0
}
target
:
{
fileID
:
9066730885846526947
}
---
!u!1
&3837569216639476273
GameObject
:
...
...
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