Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Mega bug with rotation  (Read 9339 times)

0 Members and 1 Guest are viewing this topic.

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Mega bug with rotation
« 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?.


Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Mega bug with rotation
« Reply #1 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 does it properly, but it's quite different from WME1 code, so it probably won't help you much.
« Last Edit: June 23, 2012, 01:31:19 PM by Mnemonic »
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: Mega bug with rotation
« Reply #2 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 :)
« Last Edit: June 25, 2012, 03:00:10 PM by 2.0 »
Logged
 

Page created in 0.036 seconds with 20 queries.