1
I’d like to detect if my cube on the left is touching the side of my cube on the right, but I can’t do that. Is there any method without having to create null objects, raycasts or linecast that can help me do this?
1
I’d like to detect if my cube on the left is touching the side of my cube on the right, but I can’t do that. Is there any method without having to create null objects, raycasts or linecast that can help me do this?
Browser other questions tagged c# unity3d
You are not signed in. Login or sign up in order to post.
You can use Oncollisionenter, or draw a
raio
(raycast) to detect the collision.– lazyFox
You can check a collision using the positions of the two objects... I saw you changed the question, by the way what is the need not to make use of raycast and other methods?
– lazyFox
Raycasts, nulls, colliders within other colliders, linecast are systems that do not give such great accuracy, and can cause Bugs... also have some systems that a Raycast, null, colliders within colliders and the Linecast could not be used...
– Gatti
Usually the problem is not in the collision verification method itself, but in the "run time". For example to check a frame-by-frame collision you can use Fixedupdate
– lazyFox
It’s not even because Raycast himself is bad... it’s because of the circumstance where I use him to be inappropriate... for example I want him to detect if the cube collided exactly on the side of the other... and the Raycast has to have a size, for example 0.1, so it will never tell if it crashed exactly on the side... and this can cause bugs in the circumstances that I will use... I hope you understand...
– Gatti
Well... I found out there’s a guy who can spot collisions, the Collision. In it there is the Collision.Contacts, which can detect at which point two objects collided, for example the corner of one hit in the middle of the other, the left side hit the right side of the other and etc.
– Gatti