WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-10-2014, 02:43 AM
Notch Notch is offline
Member
 
Join Date: Jan 2014
Posts: 15
Create image directly in front of head

I'd like to create a vision-occluding polygon that hangs directly in front of the virtual user's head. I need to be able to manipulate the position of this polygon, so that it covers different parts of the view depending on where I move it. By default, it will cover exactly half of the view.

I've managed to generate a polygon that is head-attached, but it seems to hang directly through the centre of the "eyes", such that the player can see through the plane. In other words, the plane does not occlude the view, but can be seen if you look around.

How can I code this plane to sit slightly further forwards, so that it obscures the view of the world? Here's what I'm using at the moment ('scotoma.png' is simply a 128x128 coloured square):

Code:
scotoma = viz.addTexture('scotoma.png')
quad = viz.addTexQuad(parent=viz.HEAD, texture=scotoma,size=50)
I've tried using the following to manipulate the position of the polygon:

Code:
quad.setPosition(quad.getPosition() + [0, 10, 0])
... But it doesn't seem to shift the polygon at all.

Any ideas? It's important that the polygon is head-relative, as I need to shift it around a little bit from time to time.

Any help would be greatly appreciated.
Reply With Quote
  #2  
Old 01-10-2014, 01:09 PM
Erikvdb Erikvdb is offline
Member
 
Join Date: May 2013
Posts: 63
Quote:
Originally Posted by Notch View Post
I've tried using the following to manipulate the position of the polygon:

Code:
quad.setPosition(quad.getPosition() + [0, 10, 0])
In python, [x,y,z] + [a,b,c] actually gives you [x,y,z,a,b,c], so no wonder that doesn't work. The solution is actually much simpler. Since the quad is parented to the head, setPosition defaults to relative translation. In other words, you can simply say:
Code:
quad = viz.addTexQuad(parent=viz.HEAD, size=1)
quad.color(1,0,0)
quad.setPosition([0,0,10])
This places a red quad of 1x1 meter 10 meters in front of your view. Change size and position (and color/texture) as you see fit.
Reply With Quote
  #3  
Old 01-14-2014, 07:17 AM
Notch Notch is offline
Member
 
Join Date: Jan 2014
Posts: 15
Many thanks - works perfectly
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Eye position relative to center of head? performlabrit Vizard 1 01-07-2014 08:30 AM
360 panorama image cube using as darts target and record the xy coordinates mshukun Vizard 2 03-14-2013 06:17 AM
Custom head with 3dmenow or facegen & peoplemaker Frank Verberne Vizard 4 01-17-2013 12:46 PM
Problems with imported Facegen head Don Vizard 1 11-04-2011 01:27 AM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM


All times are GMT -7. The time now is 10:15 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC