프로젝트

일반

사용자정보

통계
| 개정판:

t1 / TFDContents / Assets / KinectDemos / AvatarsDemo / Scripts / OffsetNodeMover.cs @ 3

이력 | 보기 | 이력해설 | 다운로드 (665 Bytes)

1
using UnityEngine;
2
using System.Collections;
3

    
4
public class OffsetNodeMover : MonoBehaviour 
5
{
6
	[Tooltip("Speed at which the offset node will move through the scene.")]
7
	public float moveSpeed = 1f;
8

    
9
	[Tooltip("Smooth factor used for offset node movements.")]
10
	public float smoothFactor = 1f;
11

    
12

    
13
	void Update () 
14
	{
15
		float h = Input.GetAxis ("Horizontal");
16
		float v = Input.GetAxis ("Vertical");
17

    
18
		if (h != 0f || v != 0f) 
19
		{
20
			Vector3 vMoveStep = new Vector3 (h * moveSpeed, 0f, v * moveSpeed);
21
			Vector3 vMoveTo = transform.position + vMoveStep;
22

    
23
			transform.position = Vector3.Lerp (transform.position, vMoveTo, Time.deltaTime * smoothFactor);
24
		}
25
	}
26

    
27
}