About Store Forum Documentation Contact



Post Reply 
attached items flicker
Author Message
b1s Offline
Member

Post: #1
attached items flicker
This issue have been with us for quite while.
When i attach an item to player like this:
Code:
        tricycle().actor.matrix(Matrix().setPosDir(pos()-Vec(0,0.175,0),this->matrix().z,Vec(0,1,0)));
Vec vel,ang_vel; GetVel(vel,ang_vel,matrix(),tricycle().matrix()); // calculate velocities between old and new matrixes
tricycle().setDrawingVelocities(vel,ang_vel); // put the velocities to be used in motion blur drawing

When the tricycle object does not have skeleton or animations.
everything works fine. but when its animated it starts to flicker while the player moves and does not come along smoothly.
this does not look like motion blur problem, but i cant be sure.
(This post was last modified: 07-14-2010 02:37 PM by b1s.)
07-14-2010 02:37 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: attached items flicker
can you post some screens or video so I could see what's the problem?
you can also try looking in Bloody Massacre, or ERPG2 source codes.
07-14-2010 04:58 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #3
RE: attached items flicker
yeah.. i did copy some of that code from blood massacre.. screens wont really show the flickerin i would have to take some video to really show it.
it seems like the second item is just lagging a bit behind from time to time.
07-14-2010 08:45 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #4
RE: attached items flicker
Okay this image might not explain it very well.
but lets try:
[Image: tricycle.jpg]

The bike is flickering underneath the floor there.
it probably has something to do with collisions or what ever.
i have tried following stuff:


actor.activate(false);
actor.collision(false);
kinematic = true;

And also i tried creating a joint between the actors..

In all cases it has some sort of similar problems.
07-15-2010 09:36 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: attached items flicker
yeah, a video would be better smile
in it you could also enable Physics.draw to show the physics
07-15-2010 10:13 AM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #6
RE: attached items flicker
:(
07-15-2010 10:39 AM
Find all posts by this user Quote this message in a reply
Spugeson Offline
Member

Post: #7
RE: attached items flicker
The tricycle should act as a child; We fixed the flickering by manualy calling update for the tricycle from the player script.

Does this now mean the update is called twice for tricycle?
07-15-2010 11:14 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: attached items flicker
well I dont know what is the tricycle smile
is it a member of player? a game object?
07-15-2010 12:07 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #9
RE: attached items flicker
its an extended item object.
07-15-2010 12:34 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: attached items flicker
Game::World.update calls update only on the main objects, sub objects need to be processed manually.
07-15-2010 12:53 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #11
RE: attached items flicker
h.
virtual bool update();


cpp.
bool ItemObject::update()
{
return __super::update();
}
07-15-2010 12:56 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: attached items flicker
no,

I mean that if you have

struct Game::Chr
{
Game::Obj sub_obj;
};

Game::ObjMemx<Game::Chr> chrs;

then Game::World will call only 'update' for chrs objects,
you must manually call 'update' and other methods for 'sub_obj' object if you require for example in Game::Chr methods

Bool Game::Chr::update()
{
__super::update();

sub_obj.update();
}
07-15-2010 01:10 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #13
RE: attached items flicker
yes but this extended item object already get its update method called.
now. what we did to fix the flickering problem is:
we called the update from another place also.
like this:

tricycle().actor.matrix(Matrix().setPosDir(pos()-Vec(0,0.1,0)-tricycle().actor.matrix().z*0.05,this->matrix().z,Vec(0,1,0)));

tricycle().update();
07-15-2010 02:55 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #14
RE: attached items flicker
so it means that the tricycle is stored in global object containers? and not as a member?

then maybe its just order of 'update' important

objects in containers are updated in unspecified order

you can use 'Game::Obj::reliesOn' method to specify that one object should always be updated before the other, maybe that will help.
07-15-2010 03:06 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #15
RE: attached items flicker
this might be. we will try to modify the reliesOn.
but i guess it wont be too heavy to call one objects update method twice per frame.
if we cant get it working any other way.
07-15-2010 03:10 PM
Find all posts by this user Quote this message in a reply
Post Reply