1
$\begingroup$

For a ray sensor, I want it to detect object without a specified prop. I will put it as invert. If I use invert with x-ray mode, it will invert the x-ray mode. How can I use x-ray mode to detect an object without a prop?

$\endgroup$

1 Answer 1

2
$\begingroup$

You can do that by a logic operation and two ray sensors :

1- the first ray sensor detects objects with prop
2- the second ray sensor detects any objects

the objects you want to detect are any object except the ones that have prop so use the expression : Ray_2 and Not Ray_1

enter image description here

$\endgroup$
6
  • $\begingroup$ Thanks, never thought of this this way. I have another issue: I have the ray > python. You have an expression. For this scenario, I'm assuming I put the expression in the script. How would I do this? (I have it where an object will track to the ray.hitObject, the reason I need python) My code is in this problem: blender.stackexchange.com/questions/32729/… $\endgroup$
    – blackhole
    Jul 7, 2015 at 9:04
  • $\begingroup$ Would this new issue be another question or would you like another answer to your current problem? $\endgroup$
    – ruckus
    Jul 7, 2015 at 16:20
  • $\begingroup$ @blackhole you should have specified that either in the the question or its tags,BTW you already have the right code : if (ray.hitObject and not 'prop' in ray.hitObject): $\endgroup$
    – Chebhou
    Jul 7, 2015 at 16:40
  • $\begingroup$ Well, I also thought that was the right code. The problem is, if an object is inside/behind an object with the prop, the ray will not track to it. Thus, I needed x-ray mode but I was using invert, so I had to think of something. I thought of this [question] in hopes of it solving it. Anyways, the code is good but I need x-ray. If I toggle it, it won't work as I have it as invert. $\endgroup$
    – blackhole
    Jul 7, 2015 at 22:08
  • $\begingroup$ @blackhole X-Ray depends on the prop to decide if it should pass through or stop at this object , i think the easy way would be to add a prop2 to all other objects that don't have prop and set the ray-sensor to look for prop2 in X-Ray mode $\endgroup$
    – Chebhou
    Jul 8, 2015 at 0:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .