The Gamegrammer | 게임하는 프로그래머

닫기 검색결과 전체 보기

    유니티(Unity) | Random Point On Sphere

    Programming/Unity 2017. 10. 8. 13:59



    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    public Vector3 RandomPointOnSphere(float radius)
    {
        float u = Random.Range(0f, 1f);
        float v = Random.Range(0f, 1f);
     
        float theta = 2f * Mathf.PI * u;
        float phi   = Mathf.Acos(2f * v - 1);
     
        Vector3 vec;
        vec.x = radius * Mathf.Sin(phi) * Mathf.Cos(theta);
        vec.y = radius * Mathf.Sin(phi) * Mathf.Sin(theta);
        vec.z = radius * Mathf.Cos(phi);
     
        return vec;
    }
    Colored by Color Scripter
    cs


    저작자표시 비영리 변경금지 (새창열림)
    'Programming/Unity' 관련 글 more
    • thumbnail
      유니티(Unity) | 시야각(FieldOfView) 만들기 | 01 | 2D 시야각 2017.10.10
    • thumbnail
      유니티(Unity) | Random Point Inside Sphere 2017.10.08
    • thumbnail
      유니티(Unity) | Random Point On Circle 2017.10.08
    • thumbnail
      유니티(Unity) | Random Point Inside Circle 2017.10.08
    Posted by Muramasa
블로그 이미지

by Muramasa

    최근...

  • 포스트
  • 댓글
  • 더 보기

태그

  • 랜덤
  • FieldOfView
  • 시야각
  • 메쉬
  • 유니티
  • 계산기
  • Circle
  • random
  • 에디터
  • unity
  • c++
  • sphere
  • 2d
  • Mesh

카운터

Total
Today
Yesterday

공지사항

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록
Muramasa's Blog is powered by daumkakao
Skin info material T Mark 5+ by 뭐하라
favicon

The Gamegrammer | 게임하는 프로그래머

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록

관리자 메뉴

  • 관리자 모드
  • 글쓰기
  • 분류 전체보기 (16)
    • 비공개 포스팅 (0)
    • Programming (16)
      • Unity (7)
      • Unreal (0)
      • C++ (9)

카테고리

PC화면 보기 티스토리 Daum

티스토리툴바