PickedEntity()??

Blitz3D Forums/Blitz3D Programming/PickedEntity()??

JoeGr(Posted 2003) [#1]
I'm sure there must be an obvious answer to this...

Strangely, it seems that PickedEntity() returns an integer. What is this number? A memory address? The docs provide no explanation whatsoever. And more to the point, how do I get the entity's handle instead (eg "Cube_01")?

Thanks,


Rob(Posted 2003) [#2]
it's the actual entity.

ball = CreateSphere()
a = ball

a and ball both hold the memory address of the sphere. PickedEntity() will return the last picked entity address using line/camera/entitythingypicky.

pickedball = PickedEntity()
hideentity pickedball


JaviCervera(Posted 2003) [#3]
name$=EntityName$(PickedEntity())


Neo Genesis10(Posted 2003) [#4]
Jedive: If you're after the actual HANDLE of the entity then that exactly what PickedEntity will return. It will NOT return the variable which currently holds its handle (as there could be more than one).

camera = CreateCamera()
cube = CreateCube()

Repeat
	CameraPick camera, MouseX(), MouseY()
	entity = PickedEntity()

	If entity <> 0
		TurnEntity entity, 1, 1, 1
	EndIf
	RenderWorld
	Plot MouseX(), MouseY()
	Flip
Until KeyHit(1)



JoeGr(Posted 2003) [#5]
Thanks for the replies.

Seems I've been misusing/misunderstanding the term 'handle' slightly - apologies for that. But I think I've got it now.