Hello. I've been looking at the examples and other people's games. The documentation is missing some commands, namely: mesh, surf3d, and examine hide. (I'm not sure whether examine hide is actually valid or deprecated.) I really want docs on surf3d because I can't figure out the arguments.
Thanks for the post, I will fix the errors and missing documentation as soon as I can.
Yay, someone who wants to use the 3d!
Examine hide is valid, just not documented. It will prevent the labels of what the crosshairs are over from being shown. This lets you use the same examine code for pointing out photo locations to the court, or even for weird custom interfaces.
For surf3d, which creates a rectangle on the screen to display the 3d object on, the arguments are x, y, width, height, scaled width, scaled height. The x and y govern the upper left hand corner of the surface, the width and height are the width and height of the surface in actuality, and the scaled width and height are how big the surface is scaled to. To start, figure out what rectangle you want to use for your display, and set the x, y, and both widths and both heights the same. It will be slow, so you can lower the resolution by changing the first set of width and height.
mesh will load a wavefront obj file from the art/meshes directory. The origin will be in the center of the surf3d. Meshes can be rotated with "rotate" and moved with "scroll", as with any other object, although they have an added z component for scrolls, and an added "axis=y" or "axis=z" for rotate.
Ah, nope. surf3d just creates the surface that renders the 3d world. The texture is defined in the object file. Check examples/3d_real/art/models. The .obj file contains polygons and vertices, the .mtl file describes how to map the texture, and the .bmp is the texture itself. I didn't make this model, it was one I downloaded. This file format with .obj and .mtl is called wavefront .obj.
But if you look at the text of the .obj file, you will see this line:
mtllib m16.mtl
Which tells it to use m16.mtl for its material.
And then in m16.mtl, there is this line:
map_Kd m16.bmp
Which is telling it what texture to use.
It's one of the simplest 3d formats to deal with, especially for programmers, and there was already some base python code for loading it, so that's why I chose it. Also on many 3d object sites they offer the models in that format.
There might be some issues with scale. Can you upload/link to the model file? If you can edit the model and make it bigger that might help. If not (i.e. you downloaded the model from somewhere and dont know how to edit it), I can look into adding a scale function.
And the axis work as follows:
x is the horizontal axis. So if you rotate along it, things should rotate up and into the screen, or down and out of the screen. Think of it like a rotating wheel of a car thats coming at you.
y is the vertical axis, so it rotates to the left and right, like a carosel.
z points into the screen, and is the default rotation axis. It will make things rotate in a flat way (not into or out of the screen). Think of it like looking at a rotating wheel as you watch a car drive to the right. This is the only axis that works for rotating 2d objects in pywright.
I just built a new computer because someone took my old one. I just got a fresh copy of PyWright so all my are on my other computer. Sorry. (I was on mac, now win. I'm also going to get Linux.) I made the model+tex myself so no explanations necessary. Please close this now.