こんばんわ。
unityで
現在、私は簡単なRPGを作成しています。
私はグラフィッカーで、あまりにもプログラムの知識がありません。
見よう見まねで、キャラクターが上下左右に移動するようにはなったのですが、
移動方向に向いてくれません。
向きを向くような記述をしているつもりですが、動きません・・
質問の仕方が悪いかもしれませんが、申し訳ないです。
以下コードです。
お答え、もしくはヒントが頂戴できれば、非常に助かります。
何卒、宜しくお願いいたします。
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float walkSpeed = 10.0F;
public float translation;
public float rotation;
// Use this for initialization void Start () { } // Update is called once per frame void Update () { float dx = Input.GetAxis ("Horizontal")*walkSpeed; float dz = Input.GetAxis ("Vertical")*walkSpeed; transform.Translate (-dx, 0.0F,-dz); if (!forceRotate) { Quaternion characterTargetRotation = Quaternion.LookRotation (direction); transform.rotation = Quaternion.RotateTowards (transform.rotation, characterTargetRotation, rotationSpeed * Time.deltaTime); } }
}
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/06/12 01:21
2015/06/12 01:23