1
$\begingroup$

I was playing with the near sensor and I was wondering if I can have a bounding box for it, that does not calculate distances from the origin point but from the (for example) faces of the mesh.

If the origin point of the mesh is something that cannot change, then could I possibly customize the bounding box so it would not be a sphere? Maybe it could have some fixed dimensions, parallel edges still though (not something complicated).

I guess it involves some scripting, any ideas?

$\endgroup$
  • $\begingroup$ why not just use a mesh with the physics type set to sensor? $\endgroup$ – X-27 wants to Reinstate Monica Nov 13 '16 at 17:57
  • $\begingroup$ I was going to go with invisible meshes and triangle or box bounding boxes after I realized I can't do this with near sensor. I never played with physics-sensor, but I'll definitely gonna search this now. My question though is purely for experimentation, I had a workaround already. $\endgroup$ – Lev Nov 13 '16 at 18:08
  • $\begingroup$ well, you'd have to have the actual mesh use two collision sensors - one to detect when it is hitting something, and one to detect when it isn't. These sensors can be connected directly to the controllers that would have received the input form the near sensor. (you can also use messages, but then you'll be stuck with a 1 logic tick delay). $\endgroup$ – X-27 wants to Reinstate Monica Nov 13 '16 at 18:11
  • $\begingroup$ It doesn't involve python as I had imagined it. I ll stick to your first suggestion. Sensor to physics and some collision sensors to the object that will collide with the player(less CPU that way, from what I read). If you want make an answer to it so I can mark it. $\endgroup$ – Lev Nov 13 '16 at 18:24
  • $\begingroup$ glad that it worked, I'll write an answer (hopefully soon). :) $\endgroup$ – X-27 wants to Reinstate Monica Nov 13 '16 at 23:45
1
$\begingroup$

A near sensor detects objects within a radius from the object's origin. This naturally means that it detects objects within a sphere, the size of which is determined by the "distance" field on the near sensor. You can, however, work around this spherical limitation fairly easily. Add a cube and modify it to whatever special shaped detection region that you want. (you don't have to start with a cube, you can use any method you want to get the mesh). Parent your special bounding shape to your player, and set the physics type to sensor, make it invisible, and set the collision bounds to triangle mesh.

And just why are you using a screen reader?

Then, you can use two collision sensors to activate whatever your near sensors would normally do. (To connect logic across multiple objects, simply select them both). Just make sure that the property you're looking to detect is on all the objects you want to be detected. (No the property doesn't have to be filled in as "WhateverYourDetecting."

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.