Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4f691aa

Browse files
committed
create Move and Line classes
1 parent c96daf8 commit 4f691aa

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed

‎Assets/Line.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class Line
6+
{
7+
public Vector3 A;
8+
public Vector3 B;
9+
public Vector3 v;
10+
11+
public Line(Vector3 A, Vector3 B)
12+
{
13+
this.A = A;
14+
this.B = B;
15+
this.v = B - A;
16+
}
17+
18+
public Vector3 GetPointAt(float t)
19+
{
20+
return A + (v * t);
21+
}
22+
}

‎Assets/Line.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Assets/Move.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class Move : MonoBehaviour
6+
{
7+
public Transform start;
8+
public Transform end;
9+
Line line;
10+
11+
void Start()
12+
{
13+
line = new Line(start.position, end.position);
14+
}
15+
16+
void Update()
17+
{
18+
transform.position = line.GetPointAt(Time.time);
19+
}
20+
}

‎Assets/Move.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎UserSettings/EditorUserSettings.asset

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ EditorUserSettings:
3232
RecentlyUsedSceneGuid-8:
3333
value: 50040407520c0a5d0b0d0d234727094444161b7c2e79246479714564e0e5676d
3434
flags: 0
35+
RecentlyUsedSceneGuid-9:
36+
value: 5301570251530c020c0b5d7540770844174f4c287d7a74347c2a1867bab9306c
37+
flags: 0
3538
vcSharedLogLevel:
3639
value: 0d5e400f0650
3740
flags: 0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /