Anchor to screen changes drawing position

captaincomic

  • *
  • Posts: 6108
I was wondering for a long time what was going on, no I can finally reproduce it.

It's a minor thing with an easy workaround, but anyway:
Using the "draw text" block in an actor behavior will normally draw the text relative to the top left of the actor. But if you anchor an actor to screen and draw text at (0,0) in a behavior for this actor, it will not draw at the top left of the actor, but at the center of the actor.

Edit: Oh, wait, it turns out to be even more obscure: it only happens when the actor has disabled physics.

Workaround: Putting a "switch to actor space for Self" in the beginning of "when drawing" fixes this, but I think this should not be necessary.

« Last Edit: April 30, 2012, 01:52:57 pm by captaincomic »

Hyptosis

  • Posts: 27
YES, this has been plaguing me for a while now. I keep having to create super stupid workarounds. Everything else I do in the actor seems relative to the screen except draw text.

Also the Switch to Actor thing doesn't seem to work for me.

EDIT: Oh, switch to screen space fixes it for me! Sorry for the bother folks!

« Last Edit: June 12, 2012, 05:54:50 pm by Hyptosis »
"Even a stopped clock gets the right time twice a day."

froz

  • Posts: 250
Yeah, I learned to always switch to actor space or screen space before drawing anything. Otherwise sometimes it looks like it remembers switching to screen space in other events or even in other behaviours (though that may be only my imagination). In other words -don't assume that the drawing will be in actor space if you don't put any switch at the beggining.