Jump to content

Controller Jitter


gamecreator
 Share

Recommended Posts

I know it seems like we just had this topic but that was camera related. Pretty sure this one's controller related. The ground is an exported collisionmesh (polygonal mesh collision shape).

 

Any idea why the controller jitters in my program?

 

 

#include "App.h"

 

using namespace Leadwerks;

 

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

 

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

 

Model* model = NULL;

Entity* player = NULL;

 

bool App::Start()

{

window = Leadwerks::Window::Create("Controller Test", 0, 0, 1280, 720, Leadwerks::Window::FullScreen);

context = Context::Create(window);

world = World::Create();

 

//Load a map

Map::Load("Maps/map2.map");

 

camera = Camera::Create();

camera->SetRotation(45, 0, 0);

camera->Move(0, 1, -15);

camera->SetDebugPhysicsMode(true);

 

Light* light = DirectionalLight::Create();

light->SetRotation(35, 35, 0);

 

model = Model::Load("Models/Barbarian/barbarian.mdl");

model->SetRotation(0, 180, 0);

 

player = Pivot::Create();

 

model->SetParent(player, false);

model->SetPosition(0, 0, 0);

player->SetMass(1);

player->SetPhysicsMode(Entity::CharacterPhysics);

 

player->SetPosition(0, 10, 0);

 

return true;

}

 

bool App::Loop()

{

if(window->Closed() || window->KeyDown(Key::Escape)) return false;

 

float move = (window->KeyDown(Key::Up) - window->KeyDown(Key::Down)) * 3;

float strafe = (window->KeyDown(Key::Right) - window->KeyDown(Key::Left)) * 3;

player->SetInput(0, move, strafe);

 

camera->SetPosition(player->GetPosition(true), true);

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

 

Time::Update();

world->Update();

world->Render();

context->Sync();

 

return true;

}

Link to comment
Share on other sites

This reportedly has been fixed in recent versions of Newton but I can't update it right now without breaking everything, s it is a more involved task.

  • 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

I would assume it's the same issue I have. The controller seems like it's always falling a little then it lifts back up a little creating the jitters we see.

 

@Gamecreator my issue was controller related as well. The controller jittering was/is the main issue. I feel like the controller should be smooth as it's moving.

  • Upvote 1
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...