moving forward to the edge
Hello,
my problem is, i have an gameobject, i placed it on a table. i want my object to move forward until it finds itself on the edge of the table. When such thing happens, i want my gameobject to move backward, to simply go back until the he finds himself on the edge again.
I have added a rigidbody and gravity, but i have problem, that OnCollisionExit triggers to late, when my GameObject is already to far. i wanted to check for partialy being over edge by checking the contactCount but it also doesnt work (sometime i get 20 contacts on collision, sometimes i got 7, and i cannot find rule, what amount of contact count means that my gameobject is partialy over edge). Im moving my GameObect with transform.position.forward, and gameobject is a simple cube.
Any hints? im begginer in Unity
Your answer
Follow this Question
Related Questions
Sphere bouncing back on edges of aligned objects 0 Answers
OnCollisionEnter doesn't work ! 2 Answers
Troubling tracking the HDM (Headset) for the HTC Vive, can anyone help? 0 Answers
Cart objects clips with rigidbody objects 0 Answers
How to make gridbased movement while also using collision? 0 Answers