How to determine on collision if an object is rotated in a certain way

I have 2 objects and when they collide I want to execute some logic only when one of the objects is in a certain rotation.

If you look at the below image.

The white board on the left will have the small white block (with the black edge) collide with it, but i only want the logic to execute if the black edge is completely touching the white board.

So effectively if the z axis is rotated at 90’ (and the y axis isn’t rotated so it’s facing away)

Here are some examples of how I would like it to work:

This should execute the logic because the black face on the object is rotated towards the white board (it can be rotated any way around the x axis and it would still be facing the board)

This one should not execute the logic on collision because the black face isn’t rotated towards the white board (it could be because the z axis is causing the black face to not face the white board or the y axis could cause it to not face either)

The outcome is to only execute the logic if the entire black face of the object has collided with the white board.

I’ve also attempted to check if the entire surface of the collider has collided but I’m not getting anywhere with it, this rotation idea seems to be the most sensible I just can’t seem to implement it.

I’ve tried looking at the objects Eular rotations but they don’t seem to provide easily usable data.

The z goes from 0 to 90 or 360 to 270, then when it passes that mark it resets back to 0. Because ideally I was checking to see if the z Eular rotation was at 90’ and the y Eular rotation was at 0’ (the x rotation can be anything) which is how I was mocking up the idea changing the rotation properties in the editor.

But when I say “is the z = 90’” it isn’t always 90’ because if you rotate the x axis then the z axis will jump back to a different number.

I also tried using Quaternion numbers but I was totally lost :frowning:

Does anyone have any ideas?

How about doing it with vectors instead, that is, if the up direction of the cube is over a certain amount into the x direction, then if must mean the black side is facing nearly flat to the whiteboard. Here’s a little example:

Transform thisBlock;
Vector3 desiredDirection;
GameObject whiteboard;

void Start(){
	thisBlock = this.transform;
}

void OnCollisionEnter(Collision c){
	if(c.gameObject != whiteboard) return;

	if(Vector3.Dot(desiredDirection, thisBlock.up) > 0.95f) return;

	//if we get here, remove collision detection or something?
	//as we hit the whiteboard but at the wrong angle
}