如何强制Unity在碰撞后不更改对象的速度和方向?我需要获取OnCollisionEnter2d事件,但不需要自动更改速度和方向;我想手动操作.
How can I force Unity to not change the speed and direction of objects after collision? I need to get OnCollisionEnter2d event, but I don't need to automatically change speed and direction; I want to do it manually.
推荐答案
我需要获取OnCollisionEnter2d事件,但我不需要 自动更改速度和方向,因为我想这样做 手动
I need to get OnCollisionEnter2d event, but i dont need to automatically change speed and direction, because i want to do it manually
如果不想在与另一个对象碰撞时影响该对象,则需要将对撞机标记为触发器.
If you don't want to affect the Object when it collides with another Object, you need to mark the Collider as Trigger.
此后,请使用触发功能而不是碰撞功能.
After this, use the trigger function instead of the collision functions.
void OnTriggerEnter2D(Collider2D other) { }它将检测到碰撞的对象不会移动它们.然后,您可以根据需要手动移动它们.
It will detect that the Objects collided it won't move them. You can then manually move them however you want.
更多推荐
unity3d(2d)中的碰撞后忽略物理
发布评论