I have a static cube object that activates an event when the player collides with it.
The thing that I want to set up is that only one side of the cube activates the event. So colliding with just one polygon of this cube, so when the player would collide with any other side of the cube, nothing would happen.
I figured the easiest way would be to assign a unique material only to that one polygon of the cube object.
But this still doesn’t work and it activates the event when colliding from any side of the object.
So I have tried to set sensors for 2 materials when colliding with the first one and not colliding with the second one would activate the event.
This still activates the event when colliding from any side.
How should I write the script for this to work and can I specify a negative collision?
collision = cont.sensors['sensor']
collision2 = cont.sensors['Sensor2']
if collision.positive and collision2.positive:
How should I write it for collision2 to be a negative collision?
The : was my mistake, I didn’t wanted to write it there.
I have tried to replicate what you suggested but it didn’t work.
Here is a test file: testCollision_001.blend (528.9 KB)
Thank you for your suggestion.
The thing is, I didn’t wanted add another static object in the scene since I would have around 100 or more of these.
So you are saying that colliding with a single polygon doesn’t work even if I set it to have it’s own texture?
I have managed to script it without the use of another static object.
Since my game layout is based on a grid and the object is a cube, I was able to restrict the collision based on the world position of the player compared to the cube.