Creating Models
Blitz3D Forums/Blitz3D Beginners Area/Creating Models
| ||
I'm creating a modeler, and I need help making it create stuff.(boxes,spheres,etc.) here's my code so far,(I just started it): Graphics3D 640,480 SetBuffer BackBuffer() cam=CreateCamera() PositionEntity cam,0,3,-3 While Not KeyHit(1) If MouseHit(1) box=CreateCube() PositionEntity box,MouseXSpeed,MouseYSpeed,MouseZSpeed ScaleEntity box,MouseXSpeed,MouseYSpeed,MouseZSpeed EndIf CaptureWorld RenderWorld UpdateWorld Flip Wend End |
| ||
You are going about it incorrectly. There are many ways to do something like this but using Mouse?Speed in the fashion you are is not the way. Tie the Camera to some keys for movement. Try creating a 3D cursor and using the Mouse?Speed commands to move the cursor around in the 3D world. To use the mouse to scale an entity you are going to need more than just a MouseHit. Use two MouseHits (MouseHit(1) and MouseHit(1) again, or MouseHit(1) and then MouseHit(2)) or MouseDown with your cursor movement function in between the two hits (or during the mousedown) to scale the entity. Of course, you need a way to save the objects in your world or else there is no point. |
| ||
I can't get the cursor to move! -me |
| ||
Have 2 variables to keep the x and y location of the mouse. Then add the value for mousespeedx and mousespeedy onto them. |
| ||
"patisawesome" - I salute you! - most people would use a pre-written modeler - but you actualy want to write your own!!! Have it!!! I get the feeling you are jumping in both feet first into this - Respect! I like reading your many forum entries - I like the fact that you want to know so much at once. For speed you may want to just use the keyboard initially, then worry about the mouse control after you have working code. Personally, I would keep it simple and then modify the code later. You need to work out exactly what you are creating - your code just creates a cube. For example, set it up so that pressing "1" creates a cube, pressing "2" creates a sphere, etc. - you can use arrow keys to move the camera - you can use numpad keys to move the selected object - you can use "+" and "-" to scale the selected object - you could use 2 keys to move forward and back through your object list (you can still simply "click" them with the mouse) - you can use keys to rotate the object, etc, etc, etc. If you start simple you can modify the code as you go and add in mouse control/scaling. What are you using your modeller for? i.e. just to play around with creating stuff for fun or are you actually intending to create complex objects/game objects? |
| ||
Thanks Puki! I'm just doing this for fun. I'll take your advice on the keyboard controls. Thanks everyone for helping! -me |
| ||
It won't create anything! -me |
| ||
you could maybe try the make3dstudiomax6() function. That too works nice for me :D |