'2013/12/09'에 해당되는 글 3건

  1. 2013.12.09 유니티 포물선 공식 (1)
  2. 2013.12.09 유니티 대화 예제
  3. 2013.12.09 유니티 text 파일로 저장하는 법

유니티 포물선 공식

|

x = S.x + V.x * t;
y = S.y + (V.y * t) - ((1/2) * g * t * t);
z = S.z + V.z * t;

t는 시간
S는 시작위치
g는 중력 가속도이지만 반드시 9.8일 필요는 없고 실제 게임에서 자연스럽게 보이는 값을 지정.

특정시간은 t의 값에 그 시간을 넣고 x,y,z를 최종위치값으로 넣어서 V값을 역산해 결정한 다음
매 프레임마다 t값을 갱신해 가면서 x, y, z를 구하시면 됨

Trackback 0 And Comment 1
  1. Favicon of https://codebakemono.tistory.com BlogIcon BAKEMONO 2016.03.08 13:39 address edit & del reply

    관리자의 승인을 기다리고 있는 댓글입니다

유니티 대화 예제

|

http://code.google.com/p/shadow-force/source/browse/trunk/Assets/Scripts/Misc/InitLevelManager.cs?r=18

public class InitLevelManager : MonoBehaviour
{
public Texture2D splash;


private Texture2D background;
private bool loading = true;


void Start ()
{
background = new Texture2D (2, 2);
background.SetPixels (new Color[] {Color.black, Color.black, Color.black, Color.black});
background.Apply ();

DontDestroyOnLoad (gameObject);
Application.LoadLevel (Application.loadedLevel + 1);
}


void OnLevelWasLoaded (int level)
{
loading = false;
}


void OnGUI ()
{
if (!loading)
{
return;
}

float splashWidth = splash.width, splashHeight = splash.height;

if (splashWidth > Screen.width)
{
float scale = Screen.width / splashWidth;
splashWidth *= scale;
splashHeight *= scale;
}

GUI.DrawTexture (new Rect (0.0f, 0.0f, Screen.width, Screen.height), background);

GUI.DrawTexture (
new Rect (
(Screen.width - splashWidth) * 0.5f,
(Screen.height - splashHeight) * 0.5f,
splashWidth,
splashHeight
),
splash
);
}

Trackback 0 And Comment 0

유니티 text 파일로 저장하는 법

|
  1. import System;
  2. import System.IO;
  3.  
  4. var  fileName = "MyFile.txt";
  5.  
  6. function Start()
  7. {
  8.         if (File.Exists(fileName))
  9.         {
  10.             Debug.Log(fileName+" already exists.");
  11.             return;
  12.         }
  13.         var sr = File.CreateText(fileName);
  14.         sr.WriteLine ("This is my file.");
  15.         sr.WriteLine ("I can write ints {0} or floats {1}, and so on.",
  16.             1, 4.2);
  17.         sr.Close();
  18. }


'잡다한것들전부 > ' 카테고리의 다른 글

유니티 포물선 공식  (1) 2013.12.09
유니티 대화 예제  (0) 2013.12.09
유니티 text 파일로 저장하는 법  (0) 2013.12.09
[펌] 유니티 런닝게임 관련 질문  (0) 2013.12.06
[펌] 유니티 러너 게임 질문  (0) 2013.12.06
[펌] 유니티 메모리 관리  (0) 2013.12.05
Trackback 0 And Comment 0
prev | 1 | next