'전체 글'에 해당되는 글 1801건

  1. 2019.04.24 행렬 (매트릭스)
  2. 2019.04.23 world, screen, viewport
  3. 2019.04.23 Quaternion.LookRotation
  4. 2019.04.21 (unity) find child recursively 1
  5. 2019.04.20 왼손 좌표계, 오른손 좌표계
  6. 2019.04.20 링크설정

행렬 (매트릭스)

3D Game Programming 2019. 4. 24. 15:11
반응형
반응형
:

world, screen, viewport

Unity3D 2019. 4. 23. 11:09
반응형
반응형

'Unity3D' 카테고리의 다른 글

Tower Defense Template (분해)  (0) 2019.05.03
LayerMask  (0) 2019.05.01
Quaternion.LookRotation  (0) 2019.04.23
(unity) find child recursively  (1) 2019.04.21
Orthographic size  (0) 2019.04.17
:

Quaternion.LookRotation

Unity3D 2019. 4. 23. 10:55
반응형

the direction can be described as the normalized difference between two points.

  1. Vector3 direction = (target.position - your.position).normalized;
  2. Quaternion look = Quaternion.LookRotation(direction);
  3. transform.rotation = look;
  4.  

https://answers.unity.com/questions/1142832/character-facing-direction-of-movement-movement-us.html

 

Character facing direction of movement - movement using camera transform? - Unity Answers

 

answers.unity.com

 

반응형

'Unity3D' 카테고리의 다른 글

LayerMask  (0) 2019.05.01
world, screen, viewport  (0) 2019.04.23
(unity) find child recursively  (1) 2019.04.21
Orthographic size  (0) 2019.04.17
How Unity Supports Cross Platform Feature  (0) 2019.03.20
:

(unity) find child recursively

Unity3D 2019. 4. 21. 18:58
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public static class GameUtils
{
    //HOW TO USE
    //var cube = this.transform.FirstChildOrDefault(x => x.name == "deeply_nested_cube");
    public static Transform FirstChildOrDefault(this Transform parent, Func<Transform, bool> query)
    {
        if (parent.childCount == 0)
        {
            return null;
        }
 
        Transform result = null;
        for (int i = 0; i < parent.childCount; i++)
        {
            var child = parent.GetChild(i);
            if (query(child))
            {
                return child;
            }
            result = FirstChildOrDefault(child, query);
        }
 
        return result;
    }
 
 
    public static Transform SearchHierarchyForBone(Transform current, string name)
    {
        //sb.Append(current.name + "\n");
 
        // check if the current bone is the bone we're looking for, if so return it
        if (current.name == name)
            return current;
 
        // search through child bones for the bone we're looking for
        for (int i = 0; i < current.childCount; ++i)
        {
            // the recursive step; repeat the search one step deeper in the hierarchy
            var child = current.GetChild(i);
 
            Transform found = SearchHierarchyForBone(child, name);
 
            // a transform was returned by the search above that is not null,
            // it must be the bone we're looking for
            if (found != null)
                return found;
        }
 
        // bone with name was not found
        return null;
    }
}
 
 
반응형

'Unity3D' 카테고리의 다른 글

world, screen, viewport  (0) 2019.04.23
Quaternion.LookRotation  (0) 2019.04.23
Orthographic size  (0) 2019.04.17
How Unity Supports Cross Platform Feature  (0) 2019.03.20
C# 컴파일 그리고 il2cpp  (0) 2019.03.07
:

왼손 좌표계, 오른손 좌표계

3D Game Programming/DirectX 2019. 4. 20. 01:36
반응형
반응형

'3D Game Programming > DirectX' 카테고리의 다른 글

링크설정  (0) 2019.04.20
HR Failed d3dutil.cpp  (0) 2019.04.20
LNK2019  (0) 2019.04.20
예제 프로그램과 웹 부록  (0) 2019.04.20
Windows 데스크톱 마법사  (0) 2019.04.20
:

링크설정

3D Game Programming/DirectX 2019. 4. 20. 01:21
반응형

반응형

'3D Game Programming > DirectX' 카테고리의 다른 글

왼손 좌표계, 오른손 좌표계  (0) 2019.04.20
HR Failed d3dutil.cpp  (0) 2019.04.20
LNK2019  (0) 2019.04.20
예제 프로그램과 웹 부록  (0) 2019.04.20
Windows 데스크톱 마법사  (0) 2019.04.20
: