Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Kein

Pages: [1]
1
Support / Re: ScreenToWorldPoint gives far off results
« on: August 18, 2017, 02:41:20 am »
The coordinate system with the tk2dCamera is 1 world unit = 1 pixel, 0,0 at the bottom left of the screen. (The output is only valid in the game window due to a bug in Unity). So to position it at x:20 y:40, set screen position to 20,40,0. You don't need to use ScreenToWorldPoint here.

So I'm confused, why in the hell is this even a thing? How to I recalculate Camera.main.ScreenToWorldPoint( Input.mousePosition) now?

2
Support / Re: Bounds and Size analogues to SpriteRenderer?
« on: July 29, 2017, 08:51:52 am »
  I may be missing something crucial here... please explain if you can, use the support email if you prefer. If you can send me a repro case I will be more than happy to look.
Just trying to adapt my script to correctly display GUI element when using WorldToScreenpoint. Right now I'm using custom Matrix for GUI itself but it is not applicable when using WorldToScreenpoint so I need to offset position of GUI element, based on sprite dimension data, manually for different than native resolution.

Hmm.

May be I'm going the wrong way about it. OK, so let's say I'm generating a simple white dummy Texture2D at runtime. Now, I have a list of objects that meet specific criteria and have tk2dSprite component attached. I make a dummy newGameObject, make it a child of TargetGameObject, attach  to newGameObject tk2dSprite comp. and my script, which uses tk2d to generate simple sprite rectangle and then I use local scale of parent to display spoken sprite beneath or on top of main sprite thus eliminating the issue of screen resolution scaling.

Is something like that doable runtime with tk2d? I'm currently looking at http://2dtoolkit.com/forum/index.php/topic,5417.msg24593.html#msg24593

3
Support / Re: Bounds and Size analogues to SpriteRenderer?
« on: July 25, 2017, 05:41:38 am »
As I said I'm limited to runtime only so I don't know pixel per world unit value. In fact, I made this thread to get them.\

Okay, so here is a problem:
http://answers.unity3d.com/questions/1384005/how-to-a-scale-worldtoscreenpoint-parts-of-the-gui.html

As I understand, the bounds and following conversion I do there gives me not the display size of a sprite in pixels but NATIVE one on my 1080p. I'm back to square one - I need to find a way to calculate  current displayed pixel size of a sprite that won't be dependent on the screen resolution.

It really Saddens me that  tk2sprite does not have simple .rect and .PPU like SpriteRenderer.

4
Support / Re: Bounds and Size analogues to SpriteRenderer?
« on: July 23, 2017, 08:30:36 pm »
The project I'm "working" with uses tk2dSprite. I don't have much of an access and freedom, I'm limited to runtime scripting only. My goal is to get center coordinates of a gameobjects that has tk2d spriterenderer/animator attached, calculate the current sprite display height and adjust the offset of custom displayed element to be below or above the current sprite bounds.
The issue is with second part of getting display height in pixels and using half of it as an offset.

UPD: no longer relevant, used this to get display pixel size: https://forum.unity3d.com/threads/how-to-scale-gameobject-to-pixel-width-and-height.130382/#post-880163

However, if you can tel me how to get the EXACT sprite center by Y in world coordinates - that would be swell. The gameobject .y position is not always correct relatively to its sprite/mesh

5
Support / Re: Bounds and Size analogues to SpriteRenderer?
« on: July 21, 2017, 11:17:38 pm »
The problem is that I do it all runtime, I don't have PPU data. If I had PPU value I wouldn't need to ask how to get PPU :P

The example script for SpriteRenderer I wanted to adopt for tk2DSprite: http://answers.unity3d.com/questions/1042119/getting-a-sprites-size-in-pixels.html

6
Support / Bounds and Size analogues to SpriteRenderer?
« on: July 12, 2017, 08:22:02 pm »
I'm looking for something that will return the same or similar values as SpriteRenderer's:
.sprite.rect.size;
.sprite.pixelsPerUnit;

I can get bounds with GetBounds and even though it returns different format I can wok with it through hoops. But what about PPU data?

My goal is to calculate height of a [current]sprite in displayed pixels. I did some search but nothing really came up.

Pages: [1]