Teachers open the door but You must enter by yourself.

Open Media Lab.
オープンメディアラボ

玉転がし
Roll a Ball

【事前学習】前回学んだ機能を再確認しておきましょう。

Camera and Play Area
Moving the Camera

入力数値

オブジェクト名種類
MainCameraN/APosition(0,10,-10)
Rotation(45,0,0)

MainCameraにアタッチするコード

InspectorでCameraControllerのPlayerにPlayerのオブジェクトをドラッグ&ドロップするのを忘れないでください。


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour
{
	GameObject player;
	Vector3 offset;

	void Start(){
		player=GameObject.Find("/Player"); //これを記述すればInspectorでPlayerを設定不要
		offset = transform.position - player.transform.position;
	}

	void LateUpdate(){
		transform.position = player.transform.position + offset;
	}
}

Camera and Play Area
Setting up the Play Area

入力数値

オブジェクト名種類
WestWallCubePosition(-10,0.5,0)
Scale(0.5,1,20.5)

【事後学習】本日学んだ機能を再確認しておきましょう。

This site is powered by Powered by MathJax