【发布时间】:2020-11-05 03:46:52
【问题描述】:
所以现在我被卡住了。我想用我的代码制作传送带,但我没有遇到这个问题。我找到了这段代码,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ConveyorPush : MonoBehaviour {
public float speed = 3.0f;
void OnTriggerStay(Collider other) {
// Assign velocity based upon direction of conveyor belt
// Ensure that conveyor mesh is facing towards its local Z-axis
float conveyorVelocity = speed * Time.deltaTime;
Rigidbody rigidbody = other.gameObject.GetComponent<Rigidbody>();
rigidbody.velocity = conveyorVelocity * transform.forward;
}
}
我明白,但由于某种原因,我在传送带上的触发碰撞器没有检测到精灵与具有刚体的非触发碰撞器的碰撞。
【问题讨论】:
-
这能回答你的问题吗? Collision detection not working unity
标签: c# unity3d debugging collision-detection collision