이씨발것 안움직임 혈압터져 디질꺼같음....
using UnityEngine;
using System.Collections;
public class Playermovement : MonoBehaviour {
public float movePower = 1f;
public float jumpPower = 1f;
Rigidbody2D rigid;
Vector3 movement;
bool isJumping = false;
// Use this for initialization
void Start () {
rigid = gameObject.GetComponent<Rigidbody2D> ();
}
// Update is called once per frame
void Update () {
if(Input.GetButtonDown("Jump")){
isJumping = true;
}
}
void fixedUpdate()
{
move ();
Jump ();
}
void move ()
{
Vector3 moveVelocity= Vector3.zero;
if (Input.GetAxisRaw ("Horizontal") < 0) {
moveVelocity = Vector3.left;
}
else if (Input.GetAxisRaw ("Horizontal") > 0) {
moveVelocity = Vector3.left;
}
transform.position += moveVelocity * movePower * Time.deltaTime;
}
void Jump()
{
if(!isJumping)
return;
rigid.velocity = Vector2.zero;
Vector2 jumpVelocity = new Vector2 (0, jumpPower);
rigid.AddForce (jumpVelocity, ForceMode2D.Impulse);
isJumping = false;
}
}
디버그에 오류도 없는디 머가 잘못되서 안움직이는고요..
겜오브젝트에 Rigidbody2d 잇는지 확인 그리고 중간에 Vector3.Left에서 Right - dc App
Vector3.left 했을때 Vector3가 (0,0,0)이라 암것도 안 일어나는거 아님? movement.left 이런걸로 해야되지 않을까
Vector3.left는 단위벡터에 방향만 잇는거라 맞음 - dc App
스크립트 걍 복붙해서 해결함 나는개빠가다
스크립트 분석하면서 공부하면 조흠 - dc App