Help us understand the problem. What is going on with this article?

一定距離のカメラ

More than 1 year has passed since last update.
CameraFollowPlayer.cs
using UnityEngine;
using System.Collections;

public class CameraFollowPlayer : MonoBehaviour
{
    public Transform target;    // ターゲットへの参照
    private Vector3 offset;     // 相対座標

    void Start()
    {
        //自分自身とtargetとの相対距離を求める
        offset = GetComponent<Transform>().position - target.position;
    }

    void Update()
    {
        // 自分自身の座標に、targetの座標に相対座標を足した値を設定する
        GetComponent<Transform>().position = target.position + offset;
    }
}

スクリプト貼り付けるオブジェクト:Main Camera
TargetにプレイヤーをD&D

カメラ1.png

キャラクターにカメラがついていきます
camera
目次に戻る

Getabako
はじめまして! 子どもにゲーム作りを通して表現力を伸ばすことを教えています 元々は臨床心理士で特別支援教育的なことをやっていました 人生が面白くなれば良いなぁと思っています 一緒に何か面白そうなことができそうと思った方はホームページより連絡下さい♪
http://getabakoclub.com
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした