About Store Forum Documentation Contact
Donations:
327$/mo



Post Reply 
[SOLVED]moving skel obj
Author Message
mixpro Offline
Member

Post: #1
[SOLVED]moving skel obj
Hi ,
i have created an animated skel from an object (the object have animation - open door) , how can i move it in the world ?
i tried :
Code:
door = ObjectPtr(UID(3856963616, 3268566013, 2296428730, 1785660301));

   skel.create(door->mesh()->skeleton(), 1.0);
  
   door->mesh()->move(Vec(2.0,0,0));

   skel.move(Vec(2.0,0,0));

but this animates the door wrong (it rotates around wrong vector), its like the bones haven't really moved (attached image explains) .
if i don't move it , it plays fine


Attached File(s) Image(s)
   
(This post was last modified: 05-09-2016 05:45 AM by mixpro.)
05-07-2016 07:50 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: moving skel obj
don't move mesh or skeleton.

Instead call animated_skel.updateMatrix(here set custom draw matrix);

AnimatedSkeleton& updateMatrix (C Matrix &body_matrix=MatrixIdentity ); // update 'AnimSkelBone' bones 'matrix' according to bones 'orn rot pos scale' and 'body_matrix', this should be called after animating and applying manual modifications, 'body_matrix' must be normalized, this method also sets skeleton points according to bone matrixes
05-08-2016 12:33 AM
Find all posts by this user Quote this message in a reply
mixpro Offline
Member

Post: #3
RE: moving skel obj
(05-08-2016 12:33 AM)Esenthel Wrote:  don't move mesh or skeleton.

Instead call animated_skel.updateMatrix(here set custom draw matrix);

AnimatedSkeleton& updateMatrix (C Matrix &body_matrix=MatrixIdentity ); // update 'AnimSkelBone' bones 'matrix' according to bones 'orn rot pos scale' and 'body_matrix', this should be called after animating and applying manual modifications, 'body_matrix' must be normalized, this method also sets skeleton points according to bone matrixes

sorry maybe i wasn't clear , by move i meant to create the obj(skel) itself at a certain position not 0,0,0 .
because :
Code:
skel.create(door->mesh()->skeleton(), 1.0);

creates it at 0,0,0 and i wanted it at other location so i asked if it can be moved .

i tired :
Code:
skel.updateMatrix(Matrix().move(Vec(2.0,0,0)).normalize());

but nothing happened
05-08-2016 07:16 AM
Find all posts by this user Quote this message in a reply
mixpro Offline
Member

Post: #4
RE: moving skel obj
plz someone ?
05-08-2016 07:44 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: moving skel obj
Hi,

Default Matrix() constructor does not initialize the matrix to identity, so when you call 'move', you adjust matrix that has undefined values.

You can do this though:

Matrix().move(..) ->
Matrix().setPos(..)

replace 'move' with 'setPos' which does initialize the entire matrix.

You can try doing this also on the tutorial:
Apps\10 - Animation\01 - Animation
05-09-2016 12:39 AM
Find all posts by this user Quote this message in a reply
mixpro Offline
Member

Post: #6
RE: moving skel obj
(05-09-2016 12:39 AM)Esenthel Wrote:  Matrix().move(..) ->
Matrix().setPos(..)

replace 'move' with 'setPos' which does initialize the entire matrix.

Thanks esenthel , that worked
05-09-2016 05:44 AM
Find all posts by this user Quote this message in a reply
Post Reply