Wintermute Engine Forum

Wintermute Engine => Bug reports => Topic started by: 2.0 on June 21, 2012, 11:02:23 PM

Title: Mega bug with rotation
Post by: 2.0 on June 21, 2012, 11:02:23 PM
Hello!

When I rotate the entity (for example, clock hand) with, for example

Code: WME Script
  1. on "LeftClick"
  2. {
  3.     this.Rotate = this.Rotate + SomeValue;
  4. }
  5.  

the visible image of the entiny is rotates, but the "logical" image is not rotated! I.e a can't click the image of the entity to rotate it again. It's necessary to click on that place where the object was initially.
So I have a question - in what place of sourses there was this detachment into two images - visible and logical?.


Title: Re: Mega bug with rotation
Post by: Mnemonic on June 23, 2012, 01:29:32 PM
This is a know limitation.

A "fix" would be non-trivial. Currently whenever an interactive entity is painted, it also registers an active rectangle on screen (using Game->m_Renderer->m_RectList.Add()). When the mouse-over is tested, it first checks what active rectangle is under the mouse pointer, and if it's a sprite, it calculates the pixel in it's texture to see if it's transparent (see CBRenderer::GetObjectAt()). To properly handle rotations, the active rectangle would need to store the rotation, then later when the mouse-over is evaluated, you'd need to apply a reverse rotation to get the proper texture coordinate.

The 2D engine in WME2 (https://bitbucket.org/MnemonicWME/wme/src/522474923904/src/wmecore/SceneNode2D.cpp#cl-515) does it properly, but it's quite different from WME1 code, so it probably won't help you much.
Title: Re: Mega bug with rotation
Post by: 2.0 on June 25, 2012, 02:55:25 PM
Thanks for the answer. Fixing trouble in sources looks pretty difficult, you're right.
I've bypassed this problem by using the auxiliary region entity with per-point rotate transformation in script.

And looking forward for WME2, of course. If it includes strengths of WME (without it small faults), it will be a masterpiece :)