PDA

View Full Version : False Viewpoint


Silvie
12-11-2015, 01:32 AM
Hi,

I'm trying to create an experimental study with worldviz and I have a problem with the viewpoint.

I'm using vizconnect and I'm trying to start different szenarios randomly from a list. So, this is the code and it works well.




list = [self.situation1,self.situation4]
random.choice(list)
for a in range(len(list)):

this = random.choice(list)
this.start()
if this == self.situation1:
self.vp = vizconnect.addViewpoint(pos=[-2, 0, -1])
self.vp.add(vizconnect.getDisplay())

elif this == self.situation4:

self.vp = vizconnect.addViewpoint(pos=[0, 0, -5])
self.vp.add(vizconnect.getDisplay())

yield this.task ()
yield viztask.waitTrue( lambda: this.lookedAt == True)
yield this.szenario()
this.reset()
list.remove(this)




The problem is, that all szenarios starts at another viewpoint and people can walk through the virtual world...so when one szenario is finished and the next starts the viewpoint is a different one and not the one I programmed. I think perhaps I had to reset the viewpoint before the next szenario starts but it doesn' work. I tried it with vizconnect.resetViewpoints()......

Has anyone an idea?? That would be great!!!

Thank you!

Silvie
12-16-2015, 02:00 AM
Please...can anyone help me? I'm really frustrated...

Jeff
12-16-2015, 06:56 AM
You can remove the last viewpoint and call resetViewpoints() after the next one is added. The following alternates between two viewpoints, vp1 and vp2:

display = vizconnect.getDisplay()

def viewTask():

while True:
vp1.add(display)
vizconnect.resetViewpoints()
yield viztask.waitKeyDown(' ')
vp1.remove(display)
vp2.add(display)
vizconnect.resetViewpoints()
yield viztask.waitKeyDown(' ')
vp2.remove(display)

viztask.schedule( viewTask() )

Does this help?

Silvie
01-04-2016, 08:11 AM
Hi Jeff,

thanks for your answer and sorry for my late answer, I was on holiday ;)

I tried your code but its not working yet-
I can see that theres something happen with the viewpoint but not the right thing....

So, I trie it tomorrow again...perhaps I can find out what the problem is and write more..

Thanks, Silvie