DES
Member
|
Slots issue
Hi,
I'm trying to add slots in my model using model's editor. When I load my model in the world the slots appear to be near world center position (in the correct relative positions with the world's center) and not are associated with the model.
I guess if there is an explicit mode to associate slots with the model, or I'm doing something wrong with the model's editor.
|
|
02-26-2013 07:54 PM |
|
DES
Member
|
RE: Slots issue
I tryed this yesterday: I imported my car's model in the racing multiplayer game project and added one slot, then i draw it and i saw it was near the world's center. After this i try to draw slots associeted with the model used by the racing multiplayer game and i saw they are drown in the correct position!! ...the code is the same so i think it a model problem but I don't understand which is the problem...my car and car used by that game seems to be the same but there must be a difference I don't see...
|
|
02-27-2013 09:22 AM |
|
gwald
Member
|
RE: Slots issue
Sorry, I don't have the racing code but try using the original car and recreating the slot until it works? did you check the check parent?
My Blog
http://www.esenthel.com/community/showthread.php?tid=6043
I hang out at Esenthel IRC Channel
http://webchat.freenode.net/?channels=#Esenthel
|
|
02-27-2013 10:07 AM |
|
Esenthel
Administrator
|
RE: Slots issue
Hi,
If you're accessing slots from Skeleton class then they are in the original Skeleton position.
If you are accessing from CSkeleton class (animated skeleton, for a character) then they are in current animation transform position.
If you have a non-animated model (like car, without CSkeleton), that uses Skeleton but does get transformed by Actor.matrix,
then you need to transform your Skeleton slot by object's current Actor.matrix
pseudo code:
Skeleton->findPoint() * actor.matrix()
|
|
02-27-2013 03:10 PM |
|
DES
Member
|
RE: Slots issue
gwald: I have added new slots to the original car used in the game and all of them work.
Esenthel: i understand the problem thanks, i used this:
body->skeleton()->findPoint(8"up_weapon")->transform(matrix());
(body is a mesh).
but I don't know how to update the position of the slot each frame. I should find a way to update it without a continuos change of the slot's matrix...
|
|
02-27-2013 09:10 PM |
|
DES
Member
|
RE: Slots issue
The car used in that game uses a Skeleton or a CSkeleton?
I found this solution, based on your pseudo code:
-in init():
originalSlotPosition = OrientP(Slot(pos, dir, perp));
-in update():
body->skeleton()->getPoint("name").pos = originalSlotPosition.pos;
body->skeleton()->getPoint("name").dir = originalSlotPosition.dir;
body->skeleton()->getPoint("name").perp = originalSlotPosition.perp;
body->skeleton()->getPoint(8"up_weapon") *= matrix();
// I can't just transform the slot by the main object's matrix otherwise the slot will keep moving in the world
So each frame a reset the position of the slot at its original and then i transform it by the matrix of the object. It works, but is this the most efficient solution?
|
|
02-28-2013 08:01 PM |
|
Esenthel
Administrator
|
RE: Slots issue
no, just do this in each frame:
OrientP temp=skeleton->getPoint("..")*matrix;
|
|
03-01-2013 04:05 PM |
|
DES
Member
|
RE: Slots issue
Thank you problem solved.
|
|
03-02-2013 01:33 AM |
|