PDA

View Full Version : Re-creating Walk-The-Plank


RECVEB_RA
02-16-2016, 02:52 PM
Hello,

I am trying to create a "walk-the-plank" virtual environment. I have made it in Sketchup 2014. The two pictures that are attached show how I would like the virtual environment to look like prior to, and after lowering the floor. Unlike the demo of walk-the-plank which also has the platform being raised, I only need the floor to be lowered. Even though I have groups in the Sketchup file, it does not seem that they transfer over into Inspector.

My question is how do I specify the "Pit" area so that when I press "1" it will be lowered, just like in the demo?

I have also posted a link to the .dae file. (https://www.dropbox.com/s/6vj7xaxq0ziexqv/Psych%20Basement%20Walk%20the%20Plank.dae?dl=0)


Here is the code for the Walk-The-Plank demo for reference. (http://codepaste.net/539fen)

Thank you for your help.

Jeff
02-19-2016, 08:31 AM
Open the model in Inspector and in the view pane highlight the part of the model that will move up and down. Find the corresponding node that's highlighted in the scenegraph tree. Right click on that node and select 'insert above' and then 'transform' and give the transform a name. Go to File > Save As to save a new version of the model with the transform node in the scengraph. See the hierarchical models (http://docs.worldviz.com/vizard/#hierarchical_basics.htm) page for example code to get a handle to a transform node in the script. You can move the floor up and down by moving the transform node.

RECVEB_RA
02-19-2016, 06:11 PM
Hi Jeff,

Thanks, I managed to specify the pit area. However, whenever I press to lower it this happens (see attached picture). I have been trying to find in the code something indicative of the final lowering point but am unable to find it. Any advice?

Jeff
02-21-2016, 01:06 AM
The floor's local coordinate system does not match Vizard's. You can highlight the floor in Inspector and activate translation to see how it's axes are oriented. The following code works to drop/raise the floor:

import viz
import vizact
viz.go()

room = viz.addChild('room.osgb')
floor = room.getTransform('floor')

def dropFloor():
floor.setPosition([0,0,0.4],viz.REL_LOCAL)

def raiseFloor():
floor.setPosition([0,0,-0.4],viz.REL_LOCAL)

vizact.onkeydown('1', dropFloor)
vizact.onkeydown('2', raiseFloor)