Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- node.js
- Excel
- GIT
- sqlite
- 리눅스
- IOS
- swift
- python
- 라즈베리파이
- 맛집
- Linux
- 함수
- urllib
- mssql
- 유니티
- MS-SQL
- pandas
- PER
- Unity
- ubuntu
- javascript
- 다이어트
- PyQt5
- PyQt
- flutter
- ASP
- 날짜
- tensorflow
- port
- MySQL
Archives
아미(아름다운미소)
[Unity] 2D 점프 본문
Unity 2D 점프
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | using System.Collections; using System.Collections.Generic; using UnityEngine; public class Jump : MonoBehaviour { Rigidbody2D rgdy; public float JP = 10f; bool isJumping = false ; // Use this for initialization void Start () { rgdy = gameObject.GetComponent<Rigidbody2D>(); } // Update is called once per frame void Update () { if (Input.GetKeyDown(KeyCode.Space)) isJumping = true ; } private void FixedUpdate() { Jumping(); } void Jumping() { if (!isJumping) return ; rgdy.velocity = Vector2.zero; Vector2 jumpVelocity = new Vector2(0, JP); rgdy.AddForce(jumpVelocity, ForceMode2D.Impulse); isJumping = false ; } } |
'랭귀지 > Unity' 카테고리의 다른 글
유니티 이미지 플립 (오브젝트 이미지 뒤집기) (0) | 2018.04.07 |
---|---|
Unity GetButton, GetButtonDown, GetButtonUp 설명 및 사용법 (0) | 2018.04.06 |
유니티 점프시 카메라이동 (0) | 2018.04.02 |
[Unity]애니메이터에 등록된 애니메이션 목록 가져오기 (0) | 2018.04.01 |
[Unity3D] Script Editor 바꾸기 (0) | 2018.03.30 |
Comments