How to check for a collission when objects aren't moving

I have a game where you control a ball (in 3D space) and it rolls down platforms.

I have certain blocks that bounce you up when you touch them. I desire to have a cooldown period after you touch the block so that it doesn’t immediately bounce you up again. I have done this in code by setting a boolean IsActive to false and then when that is false, you don’t get bounced up (velocity increased on the ball). The update loop decrements a timer and sets IsActive back to true once the timer expire so when you collide again, you get bounced.

The problem I have ran into is that my collision code is called from OnCollisionEnter() on the block. If the ball (player) jumps and lands back on the block and subsequently doesn’t move, OnCollisionEnter gets called when you first touch the block (while IsActive is false) but then not again after the cool down period ends.

I need some way of saying once the cool down is over, check if the ball and block are currently colliding. Any ideas how to accomplish this?

This seems to be working… in the Update method when the inactive timer ticks down to zero.

var playerCollider = this.player.GetComponent<Collider>();
var blockCollider = this.GetComponent<Collider>();

if (playerCollider.bounds.Intersects(blockCollider.bounds))
{
// DO stuff that happens when a collision happens. 
}

Check out these methods in the Physics class:

Physics.CheckBox
Physics.CheckSphere
Physics.OverlapBox
Physics.OverlapSphere
Physics.ComputePenetration

OverlapBox and OverlapShpere also have optimized “NonAlloc” versions that output the results to a buffer and don’t allocate extra memory.