Created
May 30, 2017 14:53
-
-
Save makochang/bdf7830418b488ac494c94719eb6e118 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Example : MonoBehaviour | |
{ | |
// Use this for initialization | |
void Start () | |
{ | |
} | |
// Update is called once per frame | |
void Update () | |
{ | |
} | |
// ギズモをレンダリングするときに呼ばれるメソッド | |
void OnDrawGizmos () | |
{ | |
Vector3 o = new Vector3 (0.0f, 0.0f, 0.0f); | |
float r = 0.1f; | |
Vector3 v1 = new Vector3 (1.0f, 0.5f, 0.0f); | |
Vector3 v2 = new Vector3 (0.5f, 2.0f, 0.0f); | |
Vector3 v3 = v1 + v2; | |
Vector3 v4 = v1 - v2; | |
Gizmos.color = new Color (1.0f, 0.0f, 0.0f); | |
Gizmos.DrawLine (o, v1); | |
Gizmos.DrawWireSphere (v1, r); | |
Gizmos.color = new Color (0.0f, 1.0f, 0.0f); | |
Gizmos.DrawLine (o, v2); | |
Gizmos.DrawWireSphere (v2, r); | |
Gizmos.DrawLine (v1, v1 + v2); | |
Gizmos.color = new Color (1.0f, 1.0f, 0.0f); | |
Gizmos.DrawLine (o, v3); | |
Gizmos.DrawWireSphere (v3, r); | |
Gizmos.color = new Color (1.0f, 0.0f, 1.0f); | |
Gizmos.DrawLine (o, v4); | |
Gizmos.DrawWireSphere (v4, r); | |
Gizmos.DrawLine (v2, v2 + v4); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment