Game Development Community

Mounted object not flipping with setFlip

by Bruno Campolo · in Torque Game Builder · 06/26/2007 (5:28 pm) · 5 replies

Hi, I'm new to TGB but not to game development. I have mounted an arm to a player's shoulder and when the player is facing right, the arm is out to the right (like a zombie). The problem is when I call setFlip(true, false); on the player, the player flips horizontally, the mount point flips horizontally, but the mounted image does not flip horizontally as it says in the docs. I have tried all combinations of "track rotation", "owned by mount" and "inherit attributes" on the mounted object.

Please let me know if this is a known issue or if I am doing something wrong.

Thanks in advance,
Bruno

About the author

Creator of Bantam City Games, a one-man independent game development studio. To learn more, check out 'A Game Developer's Saga', a game development blog at: http://www.bantamcity.com/blog


#1
06/26/2007 (8:03 pm)
The mounted objects are not flipped currently as the object that they are mounted to has no back references to the mounted objects and so does not set flip states in them when its own flip state changes. This is something you will have to do manually by calling setFlip() on all mounted child objects.

A good way to keep track of mounted nodes is to add them to a SimSet when you mount them which simplifies things should you need to reference them later.
#2
06/27/2007 (2:47 am)
The docs state the following for the "inheritedAttributes" parameter, "Whether or not to inherit certain attributes from the object this is being mounted to. The inherited attributes are enabled, visible, paused, and flip. "

The docs also state, "flipX/Y - Specifies whether each axis is flipped.
NOTE:- Mount points are flipped as well as object rendering. Objects that are mounted and owned objects are also flipped appropriately."

On top of that, I have actually tried to call setFlip on the mounted object and it will not allow the mounted object to be flipped when it is mounted. I would have to dismount the object inorder to flip it.

So it would seem to me that this is a bug. Can somebody please confirm and hopefully provide a workaround?

Thanks,
Bruno
#3
06/27/2007 (3:40 am)
The docs state the following for the "inheritedAttributes" parameter, "Whether or not to inherit certain attributes from the object this is being mounted to. The inherited attributes are enabled, visible, paused, and flip. "

The docs also state, "flipX/Y - Specifies whether each axis is flipped.
NOTE:- Mount points are flipped as well as object rendering. Objects that are mounted and owned objects are also flipped appropriately."

On top of that, I have actually tried to call setFlip on the mounted object and it will not allow the mounted object to be flipped when it is mounted. I would have to dismount the object inorder to flip it.

So it would seem to me that this is a bug. Can somebody please confirm and hopefully provide a workaround?

Thanks,
Bruno
#4
06/27/2007 (3:43 am)
Ok, I figured it out. The mounted object was actually getting flipped Horizontally eventhough I had it rotated 90 degrees when attached, so in fact from my point of view it was getting flipped Vertically and my object was symmetrical on that axis so it appeared as if nothing was happening. I redrew the object to be horizontally oriented and it appears correctly now.

I'm not sure if this is a bug or not? I would think that if an object is rotated 90 degrees and attached then when the main object is flipped horizontally the mounted object would take the rotation into account.
#5
06/27/2007 (9:17 am)
Ah I just browsed the flip code and didnt check the updateMount() code where each object reads values from the mount parent, indeed it does flip mounted nodes, sorry about the confusion.

The flipping is in object local space so is I would think is correct and not a bug - the transform takes place before rotation etc is applied.