Jump to content

how to avoid flickering for moving objects?

Recommended Posts



I'm back to Leadwerks after a long while and starting to play again with it and C++.


I've done a very basic code which moves a door (why not rolleyes.gif ).


#include "App.h"


using namespace Leadwerks;


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


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


Entity* EntityDoor;

float pos_z;


bool App::Start()


window = Window::Create();

context = Context::Create(window);

world = World::Create();


EntityDoor = Prefab::Load("Prefabs/Doors/gatevertical_door.pfb");

pos_z = 0;


//Load a map

return Map::Load("Maps/start.map");



bool App::Loop()


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




pos_z = pos_z + 0.005f;

EntityDoor->SetPosition(10 , 10, pos_z);






return true;



I can see it moving as expected but when I'm close to it, there is lot of flickering and it is even hard to keep looking at this moving door.


What are the tricks to allow a smoothing move? unsure.png


I guess there must be way to synchronize it with some refreshing update or else...


Thanks for your help!

Share this post

Link to post

Disable physics for it, using SetPosition() on physics enabled objects isn't really how you are suppose to do it. You should use forces.




Also note that the door prefab you are using has a connected script : SlidingDoor.lua


You would be better off just loading the model file (mdl) for the door in your example, not the physics enabled prefab which also has a script attached to it.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

  • Create New...