Jump to content

why is the camera not on the player when using c++????


metaldc4life
 Share

Recommended Posts

Hi,

I was just wondering why the camera is not on the player controller when I try to move around because I can hear him walkin jumping and the like but it's like a mile away from him?

 

Anyone know why!?

i'm using c++ now with Microsoft visual studio express..

 

Thanks..

 

oh and here's the code:

 

#include "App.h"

 

using namespace Leadwerks;

 

App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}

 

App::~App() { delete world; delete window; }

 

 

bool App::Start()

{

window = Window::Create("hello world", 800, 600, Leadwerks::Window::Titlebar);

 

//Initialize Steamworks (optional)

/*if (!Steamworks::Initialize())

{

System::Print("Error: Failed to initialize Steam.");

return false;

}*/

 

//Create a window

window = Leadwerks::Window::Create("");

 

//Create a context

context = Context::Create(window);

 

//Create a world

world = World::Create();

 

//Create a camera

camera = Camera::Create();

camera->Move(0,2,-5);

 

//Hide the mouse cursor

window->HideMouse();

 

std::string mapname = System::GetProperty("map","Maps/start.map");

Map::Load(mapname);

 

//Move the mouse to the center of the screen

window->SetMousePosition(context->GetWidth()/2,context->GetHeight()/2);

 

return true;

}

 

bool App::Loop()

{

//Close the window to end the program

if (window->Closed()) return false;

 

//Press escape to end freelook mode

if (window->KeyHit(Key::Escape));

}

 

Link to comment
Share on other sites

The C++ default program creates a camera in the scene controlled by the mouse and keyboard. Just remove the camera creation and control lines in the code above and it will behave the same as the Lua project.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

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...