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 - unikronsoftware

Pages: 1 ... 444 445 [446] 447 448 ... 450
6676
Support / Re: Couple of problems(rendering and flipping)
« on: February 14, 2012, 08:18:24 pm »
Hi,

Good to hear I'm not a target. Like most people, I prefer not being on anyones hitlist :D

Regarding the sprites oscillating - do you have point sampling turned on? You can often fix this issue by making sure your sprite is snapped to pixel increments.

The problem with flipped sprites is actually expected behaviour - what happens when a sprite is flipped is that its drawn the opposite way around. Unity then thinks the "front" of the sprite is actually on the opposite side to what is seen on screen. This is "fixable" by inverting all the polygons, but this is not foolproof - it will break when the sprite is flipped using the Unity transform widget. The "fix" also requires additional resources to store the inverted indices, and will increase the amount of data written - its far more efficient when it doesn't have to do it. I can advice on what to do to change it, but I recommend against doing that for code used in the game.

I can't explain the texture jumping to the first one though - is it possible to reproduce it? The fliipped value is simply a multiplier - it shouldn't affect what sprite is drawn in any way.

Cheers,
unikron

6677
Releases / Re: 2D Toolkit 1.57 beta 1
« on: February 13, 2012, 11:20:18 pm »
Quick question; is there any important reason that the default far clipping plane is 20? Or can I safely increase that number?

Thanks!

You can increase that to whatever you like.

6678
Releases / Re: 2D Toolkit 1.57 beta 1
« on: February 13, 2012, 11:19:57 pm »
Hi,

If you look at the game view, the sprite should be pixel perfect in there all the time. If it isn't, try clicking on "1:1" - if that fixes it it implies that something else has gone wrong there. Failing that, could you post your scene / project folder in the private support section / or email it to support at unikronsoftware dot com. Could be a bug...

6679
Releases / Re: 2D Toolkit 1.57 beta 1
« on: February 13, 2012, 08:17:40 am »
OK, I've found the problem - it only happens when you have a prefab created from a StaticSpriteBatcher in the project, and it is loaded in when you click Commit. A quick patch for this version:

in tk2dStaticSpriteBatcher.cs
delete line 35 - mesh.Clear()

and further down the same function, replace
mesh.vertices = meshVertices;
mesh.uv = meshUvs;
mesh.colors = meshColors;
mesh.triangles = meshIndices;
mesh.RecalculateBounds();

with:
if (mesh)
{
  mesh.Clear();
  mesh.vertices = meshVertices;
  mesh.uv = meshUvs;
  mesh.colors = meshColors;
  mesh.triangles = meshIndices;
  mesh.RecalculateBounds();
}

I will post an updated fixed version later.

6680
Support / Re: Still can't place a sprite in the right place.
« on: February 13, 2012, 01:22:12 am »
Could you recommit your sprite collection and try again? Looks like the bounds data isn't there for some reason...

6681
Releases / Re: 2D Toolkit 1.57 beta 1
« on: February 13, 2012, 12:43:43 am »
tk2dCamera mini-tutorial.

1. Create sprite collection / font, and make sure you tick "Use tk2d Camera". You will not need to set up ortho size / height as you'd normally need to. Set up as usual, and don't forget to commit.
2. In the scene, delete the Main Camera, and "Create/tk2d/Camera"
3. Create a sprite as usual - if you set up the sprite collection as in step 1, it will automatically be pixel perfect, always. Otherwise, click "1:1" to make other sprites pixel perfect. You may need to click commit on your sprite collections again for this to work properly. You will see an error in the log if this is the case.

tk2dCamera Anchor mini-tutorial.

1. Click on the camera created above, and "Create Anchor". You will have an anchor object as a child to this camera.
2. Select this anchor object, and set it up as you like - offset is the offset from the anchor. For instance if your anchor wants to be 5 pixels in from the bottom right, simply select "BottomRight" as anchor, and set offset to -5, 5 (5 pixels in horizontally, 5 pixels up).
3. Create sprites as children to this object (simply select the object, and "Create/tk2d/Sprite" will automatically parent them and these objects will now automatically be anchored.

6682
Releases / 2D Toolkit 1.57 beta 1
« on: February 12, 2012, 11:30:41 pm »
Maintenance release, not feature complete.

  • FEATURE: tk2dCamera and tk2dCameraAnchor - makes pixel perfect resolution independence easy. Check next post for mini-tutorial on how to use this.
  • FEATURE:New sample - 11 - camera and resolution independence
  • REQUESTED:Option to disable trimming on sprite collection
  • REQUESTED:Option to force square atlas
  • Script documentation. All runtime scripts are now documented. http://www.unikronsoftware.com/2dtoolkit/doc
  • BUFGIX:textmesh was calculating size with the wrong string - alignment could have been wrong in many cases
  • "1:1" now works with tk2dCamera

Still TODO for 1.57
Cache normals instead of calling Recalculate normals - will be much faster for materials with custom shaders

6683
Support / Re: Still can't place a sprite in the right place.
« on: February 12, 2012, 11:11:29 pm »
if you are using c#, and assuming you have your GameObject in myBackground...
tk2dSprite myBackgroundSprite = myBackground.GetComponent<tk2dSprite>();


6684
Support / Re: Still can't place a sprite in the right place.
« on: February 12, 2012, 09:09:50 pm »
Thats a function in 2D Toolkit - it is a function in tk2dSprite.
http://www.unikronsoftware.com/2dtoolkit/doc/classtk2d_sprite.html

what version of 2D Toolkit are you using?

6685
I've posted a reply to your other thread - I believe I answer this question there as well!

unikron

6686
Support / Re: Multiple Resolutions?
« on: February 12, 2012, 06:32:26 pm »
Hi,

Its in the private support section for registered users. Please register your copy as shown here:
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,34.0.html

Cheers,
unikron

6687
Support / Re: Still can't place a sprite in the right place.
« on: February 12, 2012, 06:31:24 pm »
Hi,

You can get this by doing the following:
Code: [Select]
// position first sprite at 100, 245, and 10 units away from the camera
sprite.transform.position = cam.ScreenToWorldPoint(new Vector3(100, 245, 10));

GameObject newSprite = GameObject.Instantiate(sprite.gameObject) as GameObject;

// get untrimmed bounds of this object
Bounds bounds = sprite.GetUntrimmedBounds();

// you can do this if the objects have the same dimensions
newSprite.transform.position += new Vector3(bounds.extents.x * 2.0f, 0, 0);

// but really what you need is
//Vector3 secondBounds = newSprite.sprite.GetUntrimmedBounds();
//newSprite.transform.position += new Vector3(bounds.extents.x + secondBounds.extents.x, 0, 0);



If you want to position a sprite (M,N) pixels away from another sprite, simply do:
Code: [Select]
Vector3 screenPosition = cam.WorldToScreenPoint(firstSprite.transform.position);
secondSprite.transform.position = cam.ScreenToWorldPoint(screenPosition + new Vector3(M, N));

Using the first method is much more reliable, as it will still work when the sprite sizes change.

Cheers,
unikron

6688
Support / Re: Scripting Refnrence
« on: February 12, 2012, 01:59:35 am »
Script reference has been posted here:
http://unikronsoftware.com/2dtoolkit/doc

Let me know what you think!

6689
The latest version will have a nicer solution to this. A working beta has been posted here, if you would like to check it out.
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,52.msg92.html#new


6690
You can use Camera.ScreenToWorldPoint and Camera.WorldToScreenPoint to work out both those values exactly without any guesswork. It doesn't matter what your orthosize or target height is set to. Simply pass screen coordinates to Camera.ScreenToWorldPoint - the only gotcha is the z component is the distance from the camera to your sprite.

Hope that helps,
unikron

Pages: 1 ... 444 445 [446] 447 448 ... 450