Jump to content

Camera moving by itself?


BES
 Share

Recommended Posts

Yeah this only happens if I use 1920x1080 for the graphics mode...I tried 1680x1050 - 800x600 and none of those have this problem..the camera spins down and im not touching any of the buttons or moving the mouse ...

 

This is pretty basic, can someone figure out why the camera is doing that? and only with 1920x1080?

 

 

require("Scripts/constants/engine_const")
RegisterAbstractPath("")
--graphics mode
Graphics(1920,1080)
--framework
fw = CreateFramework()
--camera
camera = fw.main.camera
camera:SetPosition(Vec3(0,2,-10))
--create light
--light1 = CreateDirectionalLight()
--light1:SetRotation(Vec3(45,45,0))

--load a sound
--sound1 = LoadSound("abstract::")
--PlaySound(sound1)
--sound source
--source1 = CreateSource(sound1,1)
--PlaySource(source1)

--loading a scene
scene = LoadModel("abstract::Space box.gmf")
if scene == nil then
Notify("Failed to load scene")
end
scene = LoadModel("abstract::scene.gmf")
if scene == nil then
Notify("Failed to load scene")
end

MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
HideMouse(1)
camrotation = Vec3(0)
--MAIN
while KeyHit(KEY_ESCAPE)==0 do


--mouse camera movement
gx = Curve (MouseX() - GraphicsWidth()/2,gx,10)
gy = Curve (MouseY() - GraphicsHeight()/2,gy, 10)
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
camrotation.x = camrotation.x + gy /10
camrotation.y = camrotation.y - gx /10
camera:SetRotation(camrotation)
--keyboard camera movement
move = Curve (KeyDown(KEY_W) - KeyDown(KEY_S),move,5)
strafe = Curve (KeyDown(KEY_D) - KeyDown(KEY_A),strafe,5)
camera:Move(Vec3(strafe/10,0,move/10))
fw:Update()
fw:Render()
SetBlend(1)

SetBlend(0)

Flip(0)
end

Threadripper 2920X Gen2 CPU(AMD 12-core 24 thread) | 32Gigs DDR4 RAM | MSI Nvidia GeForce RTX 2070 Stock OCed | ASRock X399 Professional Gaming Motherboard | Triple M.2 500Gig SSD's in Raid0

Windows 10 Pro | Blender | Paint.NetWorld Machine | Shader Map 4 | Substance Designer | Substance Painter | Inkscape | Universal Sound FX | ProBuilder | 3D World Studio | Spacescape | OpenSky | CubeMapGen | Ecrett Music | Godot Engine | Krita | Kumoworks | GDScript | Lua | Python | C# | Leadworks Engine | Unity Engine

 

Link to comment
Share on other sites

its a rounding error...

 

add this at the top of the script:

require("Scripts/math/math")

 

then replace this section of your code with this:

dx=Round(GraphicsWidth()/2)--added this
dy=Round(GraphicsHeight()/2)--added this
MoveMouse(dx,dy)--changed this
HideMouse(1)
camrotation = Vec3(0)
--MAIN
while KeyHit(KEY_ESCAPE)==0 do
  --mouse camera movement
  gx = Curve (MouseX() - dx,gx,10)--changed this
  gy = Curve (MouseY() - dy,gy, 10)--changed this
  MoveMouse(dx,dy)--changed this

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Thanks!

Threadripper 2920X Gen2 CPU(AMD 12-core 24 thread) | 32Gigs DDR4 RAM | MSI Nvidia GeForce RTX 2070 Stock OCed | ASRock X399 Professional Gaming Motherboard | Triple M.2 500Gig SSD's in Raid0

Windows 10 Pro | Blender | Paint.NetWorld Machine | Shader Map 4 | Substance Designer | Substance Painter | Inkscape | Universal Sound FX | ProBuilder | 3D World Studio | Spacescape | OpenSky | CubeMapGen | Ecrett Music | Godot Engine | Krita | Kumoworks | GDScript | Lua | Python | C# | Leadworks Engine | Unity Engine

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...