Skip to content

3D Visualization

Ravbug edited this page Jan 12, 2019 · 2 revisions

GlovePIE now supports very simple 3D visualization. The visualizations will replace the script area when the script that uses them is running. For best results, you will need 3D models in the .x format. GlovePIE 0.40 has fixed many visualization bugs.

Use “Obj” followed by a number to represent a 3D object:

Obj1.x = Wiimote.x
Obj1.y = Wiimote.y
Obj1.z = Wiimote.z

The position and size is in meters by default, although you can use whatever units you want.

Obj1.Size = [0.05, 0.04, 0.10]

You can also set it’s angles (in degrees by default):

Obj1.pitch = Wiimote.Pitch
Obj1.roll = Wiimote.Roll
Obj1.yaw = 0

And you can set its shape:

Obj1.model = “box”

You can set the model to the name of a “.x” file, which is a DirectX 3D model. Note that using .x files can mess with the colors of other objects in the scene, I don’t know why.

You can set the colors of objects:

Obj1.color = [100%, 50%, 30%]

You can also set it as an integer 0xRRGGBB:

Obj1.color = FF804C

Camera Position

You can also set the camera position and angle with the following fields:

Cam.Yaw, Pitch, Roll, x, y, z, pos (a vector), RotMat (a rotation matrix)

Eg.

Cam.yaw = vr920.yaw
Cam.pitch = vr920.pitch
Cam.roll = -vr920.roll
Cam.z = -2 metres

You can also read the Cam.WalkFwdDir, Cam.WalkBackDir, cam.WalkLeftDir, cam.WalkRightDir, cam.WalkUpDir, and cam.WalkDownDir vectors.

Those vectors are used for adding to the camera position based on user input.

Eg.

If W then cam.pos += Cam.WalkFwdDir * 8 kph
If A then cam.pos += Cam.WalkLeftDir * 8 kph
Etc.

Background color

Set the background color to either [r, g, b] or 0xRRGGBB

Cam.BgColour = [10%, 30%, 100%]

Stereoscopic 3D

Stereoscopic 3D support has been removed in protest against MTBS3D.com (the Stereoscopic gaming organization) banning me.

So Cam.Stereo, Cam.ScreenDepth, and Cam.EyeSeparation no longer work.

(Note from Ravbug: These might work in GLovePIE 0.43, which you can download by changing the branch on this repo.)

Camera Lens

You can change the camera lens by setting its FOV:

Eg.

Cam.vFOV = 60 degrees

That sets the vertical field of view.

You can also set the NearClip and FarClip distances. Only objects between these two distances will be drawn. Setting NearClip too small makes the distant objects intersect when they shouldn’t.

Cam.NearClip = 20cm
Cam.FarClip = 100 metres

Clone this wiki locally