Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
curvedflats
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Boards
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
Flatland
curvedflats
Commits
bfffc737
Commit
bfffc737
authored
Aug 08, 2019
by
18김민수
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pathRenderer bug fix
parent
1d1cbe85
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
11 deletions
+56
-11
PathCollider.prefab
Assets/Prefabs/PathCollider.prefab
+13
-0
Test.unity
Assets/Scenes/Test.unity
+3
-3
PathCollider.cs
Assets/Scripts/PathCollider.cs
+21
-0
PathCollider.cs.meta
Assets/Scripts/PathCollider.cs.meta
+11
-0
PathRenderer.cs
Assets/Scripts/PathRenderer.cs
+8
-8
No files found.
Assets/Prefabs/PathCollider.prefab
View file @
bfffc737
...
...
@@ -12,6 +12,7 @@ GameObject:
-
component
:
{
fileID
:
8684657376034186972
}
-
component
:
{
fileID
:
8684657376034186975
}
-
component
:
{
fileID
:
8684657376034186974
}
-
component
:
{
fileID
:
1874320887972760096
}
m_Layer
:
0
m_Name
:
PathCollider
m_TagString
:
Untagged
...
...
@@ -92,3 +93,15 @@ CapsuleCollider:
m_Height
:
2
m_Direction
:
1
m_Center
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&1874320887972760096
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
8684657376034186961
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
b0dc7c4faf7b54448ac8c3d23e40fb14
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assets/Scenes/Test.unity
View file @
bfffc737
...
...
@@ -1390,7 +1390,7 @@ MonoBehaviour:
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode
:
0
m_UiScaleMode:
2
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
...
...
@@ -3226,7 +3226,7 @@ AudioListener:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1661408487}
m_Enabled
:
1
m_Enabled:
0
--- !u!20 &1661408489
Camera:
m_ObjectHideFlags: 0
...
...
@@ -3598,7 +3598,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta
:
{
x
:
3840
,
y
:
216
0
}
m_SizeDelta: {x:
1920, y: 108
0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1751424970
MonoBehaviour:
...
...
Assets/Scripts/PathCollider.cs
0 → 100644
View file @
bfffc737
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
PathCollider
:
MonoBehaviour
{
// Start is called before the first frame update
void
Start
()
{
var
loc
=
transform
.
localPosition
;
var
_x
=
loc
.
x
;
var
_y
=
loc
.
y
;
transform
.
localPosition
=
new
Vector3
(
loc
.
x
,
loc
.
y
,
0
);
}
// Update is called once per frame
void
Update
()
{
}
}
Assets/Scripts/PathCollider.cs.meta
0 → 100644
View file @
bfffc737
fileFormatVersion: 2
guid: b0dc7c4faf7b54448ac8c3d23e40fb14
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/PathRenderer.cs
View file @
bfffc737
...
...
@@ -23,7 +23,7 @@ public class PathRenderer : MonoBehaviour
// Start is called before the first frame update
void
Start
()
{
_originalPathColliderY
=
PathColliderPrefab
.
transform
.
localScale
.
y
;
_originalPathColliderY
=
PathColliderPrefab
.
transform
.
localScale
.
y
/
2
;
_pathRenderer
=
GetComponent
<
LineRenderer
>();
_ResetPaths
();
...
...
@@ -69,8 +69,8 @@ public class PathRenderer : MonoBehaviour
private
void
_DrawOnePath
(
Vector3
point
)
{
_ResetPaths
();
square
.
pathList
[
0
]
=
transform
.
localP
osition
;
square
.
pathList
[
1
]
=
transform
.
worldToLocalMatrix
*
point
;
square
.
pathList
[
0
]
=
transform
.
p
osition
;
square
.
pathList
[
1
]
=
point
;
_pathRenderer
.
SetPositions
(
square
.
pathList
.
ToArray
());
_InstantiatePathCollider
(
0
);
}
...
...
@@ -79,8 +79,8 @@ public class PathRenderer : MonoBehaviour
{
_pathRenderer
.
positionCount
=
2
;
square
.
pathList
.
Clear
();
square
.
pathList
.
Add
(
transform
.
localP
osition
);
square
.
pathList
.
Add
(
transform
.
localP
osition
);
square
.
pathList
.
Add
(
transform
.
p
osition
);
square
.
pathList
.
Add
(
transform
.
p
osition
);
_pathRenderer
.
SetPositions
(
square
.
pathList
.
ToArray
());
for
(
int
i
=
0
;
i
<
transform
.
childCount
;
i
++)
{
...
...
@@ -96,7 +96,7 @@ public class PathRenderer : MonoBehaviour
}
else
{
square
.
pathList
.
Add
(
transform
.
worldToLocalMatrix
*
point
);
square
.
pathList
.
Add
(
point
);
_pathRenderer
.
positionCount
=
square
.
pathList
.
Count
();
_pathRenderer
.
SetPositions
(
square
.
pathList
.
ToArray
());
_InstantiatePathCollider
(
square
.
pathList
.
Count
()
-
2
);
...
...
@@ -109,7 +109,7 @@ public class PathRenderer : MonoBehaviour
_pathCollider
.
name
=
"PathCollider-"
+
n
;
_pathCollider
.
tag
=
"path"
;
_pathCollider
.
transform
.
localScale
=
new
Vector3
(
0.1f
,
_originalPathColliderY
,
0
);
_pathCollider
.
transform
.
localE
ulerAngles
=
new
Vector3
(
90
,
_pathCollider
.
transform
.
e
ulerAngles
=
new
Vector3
(
90
,
(
float
)
Constants
.
RadianToDegree
(
Mathf
.
PI
/
2
+
Mathf
.
Atan
(
square
.
GetTangent
(
...
...
@@ -118,6 +118,6 @@ public class PathRenderer : MonoBehaviour
float
_newY
=
square
.
GetNthPath
(
n
).
magnitude
;
_pathCollider
.
transform
.
localScale
=
new
Vector3
(
0.1f
,
_newY
*
_originalPathColliderY
,
0
);
_pathCollider
.
transform
.
localP
osition
=
(
square
.
pathList
[
n
]
+
square
.
pathList
[
n
+
1
])
/
2
;
_pathCollider
.
transform
.
p
osition
=
(
square
.
pathList
[
n
]
+
square
.
pathList
[
n
+
1
])
/
2
;
}
}
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