How to internally return the value of a CameraPick

Blitz3D Forums/Blitz3D Beginners Area/How to internally return the value of a CameraPick

Liimbix(Posted 2015) [#1]
Hi all! Just a quick question. When you use camerapick, and if you draw the value of that pick in text on screen, it will be a number like 117328915.. It's random every time. Like so: http://postimg.org/image/sats96xa3/

You can see the number I am talking about where it says "Entity: ______" on the left side. To my knowledge, it is only possible to get this 'ID' number if you actually camerapick onto the object. Is this correct? i am asking to see if there is a way to get this number without actually looking at the object, if there is an algorithm or command that will return this customized number to the program, so that I can manipulate it without having to look at a block before i get this value. Thank you :) (i am sorry if i am not good at explaining, im not too good with english. I can restate some part of the question of you need me to)


RemiD(Posted 2015) [#2]
Yes, pickedentity() returns either the reference of the nearest picked entity or 0 if no entity have been picked.

Each time you create an entity, the variable/array entry/custom type field you use to store the reference has this reference.

ThingRoot = createpivot()
Debuglog("ThingRoot reference = "+ThingRoot)

Dim ThingRoot(10)
ThingRoot(1) = createpivot()
Debuglog("ThingRoot(1) reference = "+ThingRoot(1))

Type Thing
Field Root
End Type
t.Thing = new Thing
t\Root = createpivot()
Debuglog("t\Root reference = "+t\Root)

You may be interested in these 2 codes to know in which list to search after you have retrieved the reference and the name of an entity after a pick or after a collision :
http://www.blitzbasic.com/codearcs/codearcs.php?code=3094
http://www.blitzbasic.com/codearcs/codearcs.php?code=3095