About Store Forum Documentation Contact



Post Reply 
Slots issue
Author Message
DES Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
DES Offline
Member

Post: #2
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
Find all posts by this user Quote this message in a reply
gwald Offline
Member

Post: #3
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
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
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
Find all posts by this user Quote this message in a reply
DES Offline
Member

Post: #5
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
Find all posts by this user Quote this message in a reply
DES Offline
Member

Post: #6
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
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Slots issue
no, just do this in each frame:
OrientP temp=skeleton->getPoint("..")*matrix;
wink
03-01-2013 04:05 PM
Find all posts by this user Quote this message in a reply
DES Offline
Member

Post: #8
RE: Slots issue
Thank you smile problem solved.
03-02-2013 01:33 AM
Find all posts by this user Quote this message in a reply
Post Reply