简体   繁体   中英

Ignore physics after collision in unity3d(2d)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM