Warning Nerdy stuff ahead
This lesson is made for people with a basic understanding of VRED and python scripting. If you are unfamiliar with coding some of the concepts might be a bit hard to comprehend. This brushes up on Python concepts but it glosses over very important structure, syntax and programming theory. I suggest going to Code Academy and taking their intro to python classes.
If you would like to just experience the VR you can grab the file for free at my store. It will ask for a credit card but you can just put zeros, nothing will be charged.
Prepping the file
Before we get to the coding part, we have to add a couple things to our scene. These will later be controlled by our HTC vive controllers.
Adding a Matrix Transform
The first thing we need to add is a Matrix Transform. So in your scenegraph got to Create > Matrix Transform. Name it Main_Hand. Remember in python CAPITALIZATION counts. So keep that in mind when you are writing code.
- Go to Scenegraph
- Create Matrix Transform
- Name it Main_Hand
Add a spot light
Now we need to add a spot light. Go to your scenegraph > Create Light > Spot Light. Then place this spotlight under the Matrix Transform we just made.
- Go to Scenegraph
- Create Light
- Spot Light
- Place inside Matrix Transform name Main_Hand
Add a Switch Material
First we need to create a new material for our white ball. Go to Material Editor > Create Material > Chrome. Then remember since this will go to our white ball it needs the color_room hdr. So go to common right click environment and chose color_room. Then create a switch Material and add in both the Chrome and the Metallic Pearl shader, then assign that switch to the white ball.
- Go to Material Editor
- Create a Chrome Material. Menu Bar > Create/Convert > Chrome
- Go to Chrome material Properties
- Scroll down to Common
- Change Environment to color_room
- Create a Switch Material. Menu Bar > Create/Convert > Switch
- Add both Pearl and Chrome Materials to switch (just drag and drop)
- Assign new Material to White Sphere.