2D Ray Casting Controller isn't registering OnTrigger

I’m new to Unity and i have a game project to do for my university to make a 2D platformer. I heard that Ray casting movement is better than rigid body. But i ran into a problem when I’m trying to make a trigger for when the player passes through a certain area but the trigger didn’t detect the player. So i tried to use the unity rigid body and moving it through the trigger and it triggered but not when i use my own controller. I’m not sure whats going on.

In order for two colliders of any kind to collide, one of the two colliding parties must have a Rigidbody. If you want to detect collisions and overlaps using the physics system, but not use the physics simulation for movement forces, you can give your player a Rigidbody and set it to Kinematic. That will make it so that your player’s colliders will detect and be detected by other colliders, but your player’s position will not be affected by forces.

Additionally, if you want to use your colliders for actual physical collisions, but still not simulate around with forces, you can use the Rigidbody function MovePosition for all your player’s movements. This acts like setting Transform.position, but will collide with and/or push around any non-trigger colliders with respect to the collision matrix in your physics settings.

1 Like

Thanks the trigger detected my player i thought i was missing something but the tutorial only goes so far sometimes

Make sure and check out the Manual and Scripting API pages for Rigidbody and Collider.