Create plane from Rectangle geometry and set POSITIVE the visible side

Hello everyone!

I search a lot for this problem but no results found. For a my project issue I need to create some planes inside my scene (a blender scene) and say whether the player is in front or behind these planes.

Until here nothing of strange.

Problem is that is need:

1- Draw these plane starting from a geometry inside blender (for example a triangle)
2- Make the positive side of the plane, the side visible from the camera, and negative the other.

In pratical, the goal is to have for example a wall inside the scene (wall is a rectangle geometry inside blender scene), and says dinamically whether player is walking behind or in front of this.
Important issues are:

1- Be able to build plane dinamically using only geometry informations
2- Be able to set as positive side, the side captured by the camera

Do you have you ever faced this problem?

Here an image of situation.

Thank you very much!

you can do a simple 2d line vs point position testing.

where the line is the wall and the point is the camera position.

found this on stackoverflow :

public bool isLeft(Point a, Point b, Point c){
return ((b.x - a.x)(c.y - a.y) - (b.y - a.y)(c.x - a.x)) > 0;
Where a = line point 1; b = line point 2; c = point to check against.

If the formula is equal to 0 points are colinear.

are trying to implement face culling?

Thank you Johnny!
So in blender probabily I could simulate this using 2 little geometries for each plane simulation, from blender take their position (only 2 dimensions are ok), tracing a line and determine whether a player is on left or right (and because I decide which is point A and point B automatically I will say which is left and right).

I like this approach, is simpler and smarted compared to how I thought.

Thank you again!

happy that i’ve been of help! :smiley: