Help with object picking

Blitz3D Forums/Blitz3D Programming/Help with object picking

Guy Fawkes(Posted 2012) [#1]
Hi all, can someone please point out the error of my ways, and tell me what's wrong with this code? What I NEED it to do, is when you 1st select an object, it makes the object half transparent, and lights up the selected object, using entityFX. BUT, if another object is selected, it deselects the object, ALSO turning entityalpha to 1 again and entityfx to 0, so the object is back to normal. It ALSO does the entityalpha 1 and FX 0 thing, if u click anything else, and picked = 0.



Here's the code:








Any help would be GREATLY appreciated! :)



Thanks! :)

Last edited 2012


Rob the Great(Posted 2012) [#2]
There's just not enough here to know what's going on. How do you go about picking the object? Do you use Types to store which objects are/were selected?


Guy Fawkes(Posted 2012) [#3]
Here, I've re-created the problem:







Try clicking an object once. it should turn half invisible. Click on the same object again, OR click any OTHER object OR click the screen, and it should turn back to fully visible.



It does not do that.



Thanks, Rob! :)

Last edited 2012


Rob the Great(Posted 2012) [#4]
This kind-of solves the problem:

Two things, though:
1. Look at my spacing compared to yours. I don't know why your code had such odd spacing, but it makes it very difficult to know which scope you are currently in.
2. You really should consider using Types for this kind of system. Otherwise, you will be very limited with what you are able to do with the selected objects. Right now, the only thing that happens is you are changing the alpha and EntityFX of a single cube. You will not be able to handle multiple objects at once with this system.


Guy Fawkes(Posted 2012) [#5]
This fixed it:







Thanks alot, Rob! :)