Hello,
I want to know wich object is under given screencoordinates.
(In this test-case these are the mousecoordinates..)
How can I access the name of the object ??
Code:
import viz
viz.go()
Cube1 = viz.add('theCube.ac')
Cube2 = viz.add('theCube.ac')
Cube3 = viz.add('theCube.ac')
Cube1.translate(-3,0,15)
Cube2.translate(0,0,15)
Cube3.translate(3,0,15)
def mijntimer(num):
line = viz.screentoworld(viz.mousepos())
begin = line[:3]
end = line[3:]
info = viz.intersect(begin,end)
if info.intersected:
print 'you are over object : ', info.object.id
#mijntest = info.object
#mijntest.Name() ...??
#I want the name of the object.. Cube1, Cube2 or Cube3
viz.callback(viz.TIMER_EVENT,mijntimer)
viz.starttimer(0,0.5,viz.FOREVER)
for now the output is :
Code:
Loading File: theCube.ac
Loading File: theCube.ac
Loading File: theCube.ac
** Load Time: 0.38 seconds
you are over object : 0
you are over object : 1
you are over object : 2
you are over object : 2
you are over object : 1
you are over object : 2
I would like it to be :
you are over object : Cube1
you are over object : Cube2
you are over object : Cube3
can anyone help me ?
thanks,
geoffrey.
btw : I attached the file theCube.ac but changed the extention to txt (otherwise I could not attach it)