PickedEntity doesn't work for me

BlitzMax Forums/MiniB3D Module/PickedEntity doesn't work for me

Barbapapa(Posted 2007) [#1]
DebugLog "PickedEntity(): "+String(PICKEDENTITY())


I looked in the MiniB3D.bmx if it was defined, it is, but it doesn't work in any of the examples. Any ideas?


bradford6(Posted 2007) [#2]
pickedentity returns the entity that was picked via linepick,campick, etc.

you need to set those.

there is a picking example in the minib3d examples folder


Barbapapa(Posted 2007) [#3]
?? ... ?? I actually tried it with the samples, but all the entries are marked quoted, and when unquoted they give an error message. Maybe I have to cast them before?

Edit:
Actually...
DebugLog "PickedEntity(): "+ PICKEDENTITY().toString()
seems to do the trick.


bradford6(Posted 2007) [#4]
try this:




Barbapapa(Posted 2007) [#5]
I know my english isn't the best, because I have the impression we are talking about different things.

The xxxxx.toString() did what I wanted (see my last post), no problems anymore! Your example is surely very kind, but I don't get your point? But thanks anyhow for your kind help!


Warren(Posted 2007) [#6]
The communication problem stemmed from you describing your problem as "doesn't work". In the future, please describe specifically what behavior you want to see and then describe what you are currently seeing. That will keep the thread on track.


Barbapapa(Posted 2007) [#7]
Well if you have a look at all the MiniB3D examples you will see that once you unquote the above mentioned line you will get an compiler error, thus it doesn't work ;) By using the method toString() instead of String(PickedEntity) it 'works'.

But I will try to be more specific in the future.


bradford6(Posted 2007) [#8]
it works until you unquote it. you will find alot of examples of commented code that remains in the final versions. it is part of the coding process.


anyway, here is some more detail

Function PickedEntity:TEntity()
		Return picked_ent
	End Function
	
	Function PickedSurface:TSurface()
		Return picked_surface
	End Function
	
	Function PickedTriangle()
		Return picked_triangle
	End Function



PickedEntity() returns a TEntity handle
PickedSurface() returns a TSurface handle
PickedTriangle() returns an int (i think)


Barbapapa(Posted 2007) [#9]
Thanks bradford6, I'm new to oop, new to BMax and new to MiniB3D ;) In reality you always think you understood what you have read until you actually use it in practice ;) But I have a small project in mind, so I'm really motivated, but I must always understand, not simply copy&Paste. It would have been nice if simonh would have coded all with superstrict on :)