Item::setTransform not fully working
by Kevin Johnson · in Torque Game Engine Advanced · 07/10/2005 (2:56 pm) · 5 replies
Hey ive noticed that when you rotate an item in the mission editor (alt-drag) and save the mission, the objet returns to its original position on next load..
In TGE this works as i would expect..
Or is it something im missing??
In TGE this works as i would expect..
Or is it something im missing??
#2
In the mission editor you can press "alt" and drag about an axis (in this case z). And the object (static shape) will rotate about that axis. Save the mission and the the static object rotation has changed.
Do this same thing with a Item, and the item goes back to its original position/rotation on mission reload.
IN TGE the item's position/rotation is saved. So, just for grins I merged TGE item class with TSE. (There were very few differences) Same thing.. The curious thing, however is the collision box.. It IS changing its rotation, but the actual mesh inside the collision box is pointing in the original position.
A simple demonstartion would be using the orc gun. Place it in a mission, uncheck rotate, save and reload mission, use the gizmo to rotate the object about z (alt-drag), save and reload the mission again, and the item will return to its original rotation.
make since?
07/13/2005 (9:07 am)
Hehe thats not what i meant, Let me explain a little better.. In the mission editor you can press "alt" and drag about an axis (in this case z). And the object (static shape) will rotate about that axis. Save the mission and the the static object rotation has changed.
Do this same thing with a Item, and the item goes back to its original position/rotation on mission reload.
IN TGE the item's position/rotation is saved. So, just for grins I merged TGE item class with TSE. (There were very few differences) Same thing.. The curious thing, however is the collision box.. It IS changing its rotation, but the actual mesh inside the collision box is pointing in the original position.
A simple demonstartion would be using the orc gun. Place it in a mission, uncheck rotate, save and reload mission, use the gizmo to rotate the object about z (alt-drag), save and reload the mission again, and the item will return to its original rotation.
make since?
#3
07/13/2005 (4:43 pm)
OK, I put it in the bug log.
#4
by adding
item.cpp Item::packUpdate()
then read that in unpackdata() into MatrixF mat instead of mObjToWorld
does that sound right??
07/14/2005 (11:08 pm)
Hey.. i think i got this workingby adding
item.cpp Item::packUpdate()
MatrixF trans = getTransform();
mathWrite(*stream, trans);then read that in unpackdata() into MatrixF mat instead of mObjToWorld
does that sound right??
#5
and it's corresponding unpack code, it should be handling the rotation across the net.
On the initial update, InitialUpdateMask should be 0xffffff, which would mask in RotationMask, and therefore, it should be running that code when the object is first created.
My bet is there's something wrong with this rotation code, or it's not being called for some reason.
07/20/2005 (10:28 am)
Yes, that is right, but it's redundant assuming the RotationMask is working properly in Item. If you look at this in ::packUpdate():if (stream->writeFlag(mask & RotationMask && !mRotate)) {
// Assumes rotation is about the Z axis
AngAxisF aa(mObjToWorld);
stream->writeFlag(aa.axis.z < 0);
stream->write(aa.angle);
}and it's corresponding unpack code, it should be handling the rotation across the net.
On the initial update, InitialUpdateMask should be 0xffffff, which would mask in RotationMask, and therefore, it should be running that code when the object is first created.
My bet is there's something wrong with this rotation code, or it's not being called for some reason.
Torque Owner Brian Ramage
Black Jacket Games
if (!mRotate) { // Forces all rotation to be around the z axis VectorF vec; mat.getColumn(1,&vec); tmat.set(EulerF(0,0,-mAtan(-vec.x,vec.y))); }Looks like it will only rotate along z axis. TGE probably does this too.