LoginSignup
0
2

More than 5 years have passed since last update.

プレイヤーが乗ったら足場から落ちないようにする(プレイヤーの子オブジェクトにする)※編集中

Posted at
notfall.cs
using UnityEngine;
using System.Collections;


public class notfall : MonoBehaviour
{
void OnCollisionEnter(Collision col) {
    if (col.gameObject.tag == "MoveStage") {
        transform.SetParent(col.transform);
    }
}

void OnCollisionExit(Collision col) {
    if (col.gameObject.tag == "MoveStage") {
        transform.SetParent(null);
    }
}
}
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2