Hello Guest

Author Topic: Changing spriteId on runtime, bug while rotating?  (Read 4117 times)

Dajuice

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Changing spriteId on runtime, bug while rotating?
« on: November 27, 2012, 08:05:34 pm »
Hi there, I was messing around with my timeline class when all of a sudden the wings of my monsters started to look really silly. After some investigation, I realized that they began to have a weird rotation when my wings were flashing, the flashing is a baked flash, so they switch to a lighted version of the image and return to their original graph and so on for an amount of time. So I figured that it is when I change SpriteId that the rotation is somehow resetted or altered.

Something I should make clear is that the rotation/position values of the offset sprite shown in the inspector (and the parent's rotation/position) are the same as a non-offset sprite, but visually, their rotation is clearly not the same, even stranger is if I manually set the rotation of the offset sprite, visually, their rotation becomes the same.

I don't know if you could help me sort this out?
thanks.

Dajuice

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Changing spriteId on runtime, bug while rotating?
« Reply #1 on: November 27, 2012, 08:18:11 pm »
One more thing: it seems that if I put the sprites inside a container, it all works well and the said "bug" was only happening on one of the two wings.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Changing spriteId on runtime, bug while rotating?
« Reply #2 on: November 27, 2012, 10:57:02 pm »
I'm couldn't work out how this is set up, and what timeline you were using, how are you switching spriteIds?

Dajuice

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Changing spriteId on runtime, bug while rotating?
« Reply #3 on: November 28, 2012, 02:44:07 pm »
I'm changing spriteId with sprite.spriteId = int newSpriteIdVar.
The timeline I'm talking about is one I've made, but the thing is if I don't change the spriteId, it works well, if I put my sprite inside the gameObject that will be controlled by the timeline instead, it works well, but when I try to control the sprite and change the spriteId, it becomes offset, I see it when I change the spriteId, the sprite don't have the good rotation as if it was resetting, but the rotation value on the transform is good. As I said earlier, it happens on only one of both wings, the other is good... maybe I could send you the project so you can further investigate on this? On my side I consider it fixed (patched would be a more accurate term) but maybe it could help you?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Changing spriteId on runtime, bug while rotating?
« Reply #4 on: November 28, 2012, 11:16:01 pm »
I could take a quick look at it to see if I can spot anything wrong? If you'd like me to, drop an email to support@unikronsoftware.com