How to make OnCollisionEnter work with RididBody and transform.position manipulation?

Hi

I have a rigidbody attached to my player and I’m manipulating the transform to move around (transform.position += Forward ⋆ Time.deltaTime ⋆ _speed;)

I read it’s a teleportation and it bypasses the collision system, but the collision works just fine with box colliders with my moving scripts in LateUpdate. However OnCollisionEnter is not called! How can that be?
My character can’t move through the box colliders, but I’d like to add extra scripts on these collisions.
How do I do that?
(I’ve tried OnTriggerEnter which works, but then I go through the object. I’d rather not have colliders, one for physics, one for the scripts)

Thanks

From what I understand it dose collide with other objects but OnCollisionEnter is not called.

so how about using a Physics.OverlapBoxlike this:

    Vector3 playerWidth;
    int playerLayer = 10; //The Layer of the Player

    void LateUpdate()
    {
        playerWidth = transform.localScale * 1.1f;
        Collider[] other = Physics.OverlapBox(transform.position, playerWidth / 2, transform.rotation, playerLayer);

        if(other.Length != 0)
        {
            //Code
        }
    }

if it is a 2D game then use something like this:

    Vector2 playerWidth;
    int playerLayer = 10; //The Layer of the Player

    void LateUpdate()
    {
        playerWidth = transform.localScale;
        Collider2D other = Physics2D.OverlapBox(transform.position, playerWidth / 2, transform.rotation.z, playerLayer);

        if(other != null)
        {
            //Code
        }
    }

I hope it will work for you.

Your solution is working so I gave an upvote, however my problem was related to logging. The OnCollisionEnter did call normally, but the Debug.Log failed to generate the message, it was only visible when I exited the game view, I don’t know why. Collapse was turned off, so I should have seen the messages.

So here are the details in case someone finds this post:
Player: controlled by transform.position += Vector manipulation. Rigidbody attached to it. Uses capsulecollider.
Obstacle object: simple box collider. Mesh collider does not callback to OnCollisionEnter. Object tagged as “Obstacle”.
OnCollisionEnter in the player controller’s script:

void OnCollisionEnter(Collision col)
    {                
        if (col.gameObject.tag == "Obstacle")
        {
           //stuff to do
        }
    }