www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: qjvictor on November 21, 2006, 09:14:07 pm

Title: how to solve the shaking problem?
Post by: qjvictor on November 21, 2006, 09:14:07 pm
I have some objects moving in my 3D game, but when the objects move, the whole screen looks a little bit shaking, which is not acceptable. Could I adjust some parameters in the Config or World or Camera to solve such a problem?

thanks.
Title: how to solve the shaking problem?
Post by: cyberkilla on November 21, 2006, 10:22:30 pm
That is interesting.
I have no idea what you are referring to, but I do recall
this happening if your backbuffer isnt used properly.

When superimposing sprites onto the map, changes to the positions of
them were done, and you end up with things shaking as the positions
of some where altered before the redraw, and some missed it and were left behind by a pixel or to.

I would imagine you are speaking of a different phenomenon, but
I thought id mention this:)
Title: how to solve the shaking problem?
Post by: EgonOlsen on November 22, 2006, 12:30:48 am
Hard to tell what you are experiencing here and what do you mean with "shaking"? Are you by any chance manipulating objects and/or the world from another thread than the rendering takes places in when moving?
Title: how to solve the shaking problem?
Post by: cyberkilla on November 22, 2006, 01:00:45 am
That is exactly what I meant:P
Title: yes, a thread controls the objects' movement
Post by: qjvictor on November 22, 2006, 04:00:37 pm
A thread reads position data from database, and move the objects to the position. The problem is when the objects move to the specified position, the objects keep on shaking. That means the movement is not smooth as excepted.
Any body can give me some tips about this question?
Title: how to solve the shaking problem?
Post by: cyberkilla on November 22, 2006, 05:21:45 pm
I might not grasp what you are saying, but it looks like what me and egon just said:).

If you manipulate the positions of them in one thread, and it isnt synchronised with the thread that does the painting, you end up with shaking.
Its hard to explain.

You NEED to translate the objects, THEN paint.

If i dont understand you still, my bad:P
Title: how to solve the shaking problem?
Post by: Melssj5 on November 22, 2006, 05:22:31 pm
I think that your thread are always moving the object, maybe validating the last position with the one obtained from the database!

If you are doing so then the problem may be the precition, for example you store 2.34, 3.5678, 2.564 on you database but you get 2.34, 3.57, 2.56 then there will be a small difference between the saved and the loaded data, that may make your object to move small distances on each iteration!
Title: I found the reason, but don't know how to solve it.
Post by: qjvictor on November 22, 2006, 10:25:08 pm
Thanks for your reply.
It is because the defferent speed of every object.
for example:
     due to the different speed, the distances between the leading object and other objects are changing per 10 ms, and my camera is always looking at the leading object, so from this camera's view, the other objects are shaking,  for example, the first 10 ms, object 2 is behind 3 pix to the leading one, after 10 ms, object 2 is behind 5 pix to the leading, and maybe after another 10ms, object 2 is behind 1 pix to the leading.  I make the camera focus on the leading one, so it seems that the object 2 keep on shaking.

But I don't figure out how to solve this.
Title: I fixed the problem.
Post by: qjvictor on November 23, 2006, 04:40:39 pm
after I change the speed, make sure every step is small enough, the shaking problem is solved.
thanks.