forward/back speed increases infinatley :/
Blitz3D Forums/Blitz3D Beginners Area/forward/back speed increases infinatley :/
| ||
Graphics3D 800,600 light = CreateLight() camera = CreateCamera() cube = LoadMesh("cube1.3ds") PositionEntity camera,0,0,EntityZ(cube)-600 Global cubez# = 0 While Not KeyHit(1) cubex = MouseX() cubey = MouseY() If KeyDown(200) = True cubez# = cubez# + .2 ElseIf KeyDown(208) = True cubez# = cubez# - .2 Else cubez# = 0 EndIf PositionEntity cube,0,0,0 MoveEntity camera,cubex,cubey,cubez# UpdateWorld RenderWorld Flip Wend When I push up key or down key the speed starts of slow and icreases till its warp drive. cubez = cubez + .2 should move the cam slowly. In 2d if you did dudex = dudex + (whatever) you would get a constant speed, not an increase in speed till its going to fast. How do i fix? thx :) I like toast |
| ||
Here is the model for what Im doing. http://www.kamikazekrow.com/storage/cube1.3ds When I walk forward I cant see the other side of the room. Its just black. Dang shoulda stuk wime banjo ;) |
| ||
What room? I couldn't download the cube, but is it just a standard cube - is this meant to be the room? |
| ||
cubez=.2 not cubez=cubez+.2 |
| ||
thx eBusiness @puki Its a hollow cube. In 3DS Max I modelled it to be 50meters length/width & Height. Is this to big for blitz? Is my scaling all wrong? |
| ||
I think you will find the cube is too small (well, within your program it is) - However, not to worry you can scale it up in Blitz. |
| ||
Well its just that I was told that if I set my Max units to meters then 1 Max Meter = 1 blitz Unit. So a room 50 blitz units square cant be to small i dont think. |
| ||
but the camera starts 600'm' back from the cube's handle placement |
| ||
but the camera starts 600'm' back from the cube's handle placement hmm yes it does. So that means the cube is way to big. way way to big. Its this scaling stuff that confuses me, keeping it consistent. Is the cube to big? Should I not start by placing the camera to far from the object as scaling is distorted? I like cheese toasties |
| ||
No, it seems to small - depends on how big you want it though |
| ||
Edit: sorry about the spacing in the code - the site seems to do this on it's own.; mini-mini-mini Sausage Dweller - puki - 2004 Graphics3D 800,600; change this to whatever you want HidePointer walkspeed#=.2; speed at which the camera/player moves at - originally set to .1 (just in case you changed it) no_of_data=11; number of lines of data in mapdata SeedRnd MilliSecs(); this is vital for random numbers (helps the bot choose more randomly) light=CreateLight() ;create the ground floor1=CreatePlane() EntityColor floor1,50,255,50 PositionEntity floor1,0,-2.3,0 EntityType floor1,2 ;create camera/player Global player=CreatePivot() Global camera=CreateCamera(player) CameraRange camera,1,100 CameraClsColor camera,50,50,200; colour the sky PositionEntity player,5,1,15 EntityType player,1 ;create wall block block=CreateCube() FlipMesh block ScaleEntity block,25,25,25 EntityColor block,150,0,0 EntityAlpha block,.8 EntityType block,2 Collisions 1,2,2,3; stops you walking though the walls ; MAIN LOOP *************************************************** While Not KeyHit(1) pz=EntityZ(player) px=EntityX(player) Gosub MoveCamera UpdateWorld RenderWorld Flip Wend End ;--------------------------------------------------------------- ; I could have used functions - but gosubs will suffice (no need to use 'Global' variables) .MoveCamera mx#=-.25*MouseXSpeed() my#=.25*MouseYSpeed() MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 TurnEntity player,0,mx#,0,1 TurnEntity camera,my#,0,0,0 If KeyDown(200) Or KeyDown(17) Then MoveEntity player,0,0,walkspeed If KeyDown(208) Or KeyDown(31) Then MoveEntity player,0,0,-walkspeed If KeyDown(205) Or KeyDown(32) Then MoveEntity player,walkspeed,0,0 If KeyDown(203) Or KeyDown(30) Then MoveEntity player,-walkspeed,0,0 Return |
| ||
thx puki :) |
| ||
Play around with it - I just mashed it - there is some residue code in there that isn't needed like the SeedRnd MilliSecs(). Play around with the size of the cube and the positioning etc. |
| ||
Hey "Amon" - You may have 'Creating A Scene - In Five Easy Steps' in your '3D Samples directory' - 'RobHutchinson/Beginner Examples/Creating A Scene - In Five Easy Steps' Take a look at it. |
| ||
Addressing your problem of the cube accelerating, re-read the documentation for the movement commands, especially MoveEntity. Adding to cubez would work if you were using PositionEntity since that command places an entity at the coordinates you define. MoveEntity however places an entity relative to its current position. In other words, when you write PositionEntity object,0,0,1 you are saying to place the object at the coordinates 0,0,1. When you write MoveEntity object,0,0,1 you are saying to move the object 0 units on the X axis, 0 units on the Y axis, and +1 unit on the Z axis. |
| ||
On the subject of Max settings, I find it best to have 3dsMax set to use "Generic Units". That way, 1 unit in Max is 1 unit in Blitz. I've heard people say that meters does the same thing, but not for me it doesn't. Meters makes my scale way off. |
| ||
Hey "Amon" - I'm a doughnut (again) - I just thought of something important here - I never looked at your cube - which is kind of important. As I coudln't download it, I just did a 'CreateCube()' within your code (not knowing that your original code was meant to be a room). My references are to my own cube that I created to replace yours, not yours - so ignore everything I said about the size of the cube. |