Creating a dice in code?
Blitz3D Forums/Blitz3D Programming/Creating a dice in code?
| ||
Hi all, This seems like such a newbie question, however I'll ask it anyhow; how does one create a dice with the numbers textured on each face in Blitz 3D code only (ie. starting from createcube, how do you texture each face individually)? Kind Regards to everyone, -R |
| ||
I'm a newbie too, but I assume you could simply create a cube and then cube map the numbers onto it - "X"'s being the faces X XXXX X |
| ||
How do you cube map the numbers onto it in code? ie. dim side(6) for a=1 to 6 side(a)=createtexture(128,128) setbuffer texturebuffer(side(a) s$=str(a) text (128-stringwidth(s$))/2,(128-stringheight(s$))/2,s$ ************* WHAT COMMAND GOES HERE TO PLACE THE ************* TEXTURE ON SIDE N OF THE CUBE next |
| ||
I might be greatly leading you astray but, have a look at the help documention for "SetCubeFace" |
| ||
I suppose you could also probably create your cube out of 6 flat sides and texture each one individually and then calculate them together to make a cube - I only mentioned cube mapping as it is the new thing Blitz can do - it may not be the most efficient - you best wait for help from someone who knows their stuff - I'm no expert |
| ||
You could use cube-mapping. I suppose that's what you doing above. Basically cube mapping is one texture with six frames in it. so createtexture (768,128) and don't forget to put the cube mapping flag in. Your probably better create 6 quads and texturing each of them, and arranging them in a box shape. OR, create a texture with all six sides on it, and manually adjust the uv co-ords of each vertex so that the texture fits correctly. Or, and final or, Create your cube in a modelling program, and uv map it yourself, saving alot of cding :D |
| ||
SirRicho - I would go for the first two options as the modelling one is a bit of a cop-out versus learning to code it - as you can still model it anway if you can't code it. |
| ||
Nevermind... I've done it... I'm using vondermans physics stuff and having a play, I pivoted 6 cubes to the ODE mesh that gets created... -R |
| ||
Just a note to say that cube mapping has nothing to do with that. Cube mapping doesn't mean mapping textures onto a cube (or else we would also need, tetraedron mapping, pyramid mapping, or whateve mapping, that would be funny :) ) Standard mapping is what you want here. |
| ||
Yeah, but it's a cheap way to get around it. set the cube mapping mode to static and you've got a mapped cube :) |
| ||
while you could do this in code, the best way to do this is to use unwrap3d to unwrap a cube mesh and paint the 6 sides on a single texture... I just did it. the new unwrap3d has a cube primitive built in www.unwrap3d.com |
| ||
I painted up a quick dice code... Trying to link the image here: Use it or abuse it. I wouldn't mind a nod in the thanks you page! : ) |
| ||
Hmmm well that didn't seem to work. The "properties should tell you what to hit in your browser and ANYONE that feels like telling me what i did wrong feel free to hit me! |
| ||
Ah... here is it: |
| ||
Last Time I promise... I copied the FAQ code exactly and moved the image to the http directory I hope that works |
| ||
Well could you not use: SetSurface to something? Just a sugestion |
| ||
Wow! This brings back memories - this is my first ever post in the forums - "Not Available" was "SirRicho" - he seems to have gone now. This is kind of like going back to the first house you ever lived in. Anybody want to buy it? |