fumanshoo Posted October 23, 2012 Share Posted October 23, 2012 I know that this is a really noob question, but I am extremely new to programming in general and I've been pretty closely following Jorn theunissen's videos, specifically this one... and after following the tutorial, everything worked until I "attached" the 1st person camera. So far, I've got the camera where it's supposed to be this far into the tutorial, but it wont stop spinning to the left. If anyone would be willing to explain why this is happening and how I can fix it, it would be much appreciated. errr, I don't think my attachment properly uploaded... here's what I've written... require("Scripts/constants/engine_const") COLLISION_CHARACTER=1 RegisterAbstractPath("") Graphics(800,600) fw = CreateFramework() camera = fw.main.camera camera:SetPosition(Vec3(3,2,-10)) light = CreateDirectionalLight() light:SetRotation(Vec3(45,45,0)) scene = LoadModel("abstract::GeneralVisualizationoftheSlums.gmf") scene:SetCollisionType(1) scene:SetRotation(Vec3(0,90,0)) controller = CreateController(1.8,0.3,0.5 , 45) controller:SetMass(10) controller:SetCollisionType(COLLISION_CHARACTER) controller:SetPosition(camera) controller:Move(Vec3(0,1,0)) DebugPhysics(1) MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) camRotation = Vec3(0) dx = 0.0 dy = 0.0 strafe = 0 move = 0 while KeyHit(KEY_ESCAPE)==0 do gx=Curve(MouseX()- GraphicsWidth()/2,gx,3.0/AppSpeed()) gy=Curve(MouseY()- GraphicsWidth()/2,gx,3.0/AppSpeed()) MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) camRotation.x = camRotation.x + gx / 8 camRotation.y = camRotation.y - gy / 8 camera:SetRotation(Vec3(camRotation.x,camRotation.y,1)) move = Curve( (KeyDown(KEY_W)-KeyDown(KEY_S)) * 5, move , 3 ) strafe = Curve( (KeyDown(KEY_D)-KeyDown(KEY_A)) * 5, strafe , 3 ) controller:Update(0, move, strafe, jump, 25 , 10) fw:Update() camera:SetPosition(Vec3( controller.position.x, controller.position.y, controller.position.z )) fw:Render() Flip(0) end Quote Link to comment Share on other sites More sharing options...
fumanshoo Posted October 23, 2012 Author Share Posted October 23, 2012 ahhh, sorry for that, I found my flaw. I forgot to change GraphicsWidth to GraphicsHeight, sorry guys! Quote Link to comment Share on other sites More sharing options...
cassius Posted October 23, 2012 Share Posted October 23, 2012 Itsamazing how often the answer comes to you by simply asking the question,even when noone has answered. Happens a lot with me. 1 Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Pixel Perfect Posted October 23, 2012 Share Posted October 23, 2012 That is so true cassius Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
fumanshoo Posted October 23, 2012 Author Share Posted October 23, 2012 It made me look at it outside of the editor heh. It was amazing how instantly it came to me though! ... although there are still a few tweaks I have to make to perfect this. For example, the camera moves at an angle instead of normally but i'm sure i'll figure it out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.