Game Development Community

FxTileLayer2D::renderArbitraryAngleObject bug

by Chris Newman · in Torque Game Builder · 07/18/2005 (7:05 pm) · 3 replies

I have a 2 by 2 tile map but if i set the rotation to any angle it renders it as a 3 x 3 map.

chazcross.phase9studios.com/files/torque/pics/t2d/mapbug1.jpg
I found the bug with these 2 lines in the FxTileLayer2D::renderArbitraryAngleObject function
U32 tilesViewedX = mCeil( (tileClipStep[0].len() + phyTileOffsetX + 0.5f) / mTileSizeX );
U32 tilesViewedY = mCeil( (tileClipStep[2].len() + phyTileOffsetY + 0.5f) / mTileSizeY );

I fixed it by changing it to mCeil to mFloor, i havnt checked into the math on this yet but it looks to solve the issue.

U32 tilesViewedX = mFloor( (tileClipStep[0].len() + phyTileOffsetX + 0.5f) / mTileSizeX );
U32 tilesViewedY = mFloor( (tileClipStep[2].len() + phyTileOffsetY + 0.5f) / mTileSizeY );

chazcross.phase9studios.com/files/torque/pics/t2d/mapbug2.jpg

#1
07/19/2005 (12:32 am)
I'll have to take a look at that. If you set the tile-layer auto-panning, does it still work correctly?

- Melv.
#2
07/19/2005 (3:21 am)
In the "fixed" code, autopan looks like it still works correctly.
Ill have to do more testing just to make sure everything will work right with this.
#3
07/19/2005 (12:04 pm)
I just confirmed the same issue with a 4x4 tile map, it's rendered as a 5x5 when any rotation is performed on the layer. Thanks for the possible fix Chris.