[Unity] 특정 Game Object 주위를 회전시키게 하기

SYiee·2022년 11월 16일
0

Unity

목록 보기
1/13
post-thumbnail

공전

특정 오브젝트 주위를 회전 시키기

Transform.RotateAround(Vector3 point, Vector3 axis, float angle)

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

public class RotateCloud : MonoBehaviour
{
    public GameObject Planet;
    public float speed = 5.0f;

    void Update()
    {
        orbitAround();
    }

    void orbitAround()
    {
        transform.RotateAround(Planet.transform.position, Vector3.down, speed * Time.deltaTime);
    }
}

자전

스스로 빙글~빙글~ 돌기

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

public class RotatingSelf : MonoBehaviour
{
    private float speed = 10f;
    void Update()
    {
        Rotating();
    }
    void Rotating()
    {
        transform.Rotate(new Vector3(0,  0, speed * Time.deltaTime));
    }
}
profile
게임 개발자

1개의 댓글

comment-user-thumbnail
2024년 9월 15일

Alex had always enjoyed poker nights with friends, where the stakes were low and the atmosphere relaxed. When he learned about an online poker tournament with an enticing prize pool, he saw it as an opportunity https://spacefortunacasino-france.com/ to test his skills in a more competitive setting. With a mix of excitement and nervous anticipation, Alex entered the tournament, confident in his ability to hold his own.

답글 달기

관련 채용 정보