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

Pages: 1 [2]
16
Support / Re: A few questions on static sprite batcher
« on: March 13, 2014, 05:57:20 pm »
The box collider is created based on the sprite. If the sprite has a colliider set up in the collection, the batcher's commit function will create one. The Offset and extents are solely to store the z offset and extents of the box collider. Even if they were just set to zero you should see a flat box collider at that location.

I see. We are using external colliders (to contain all the info in prefabs) and I forgot about build in collider functionality for tk2d.
Now I wonder if I could add colliders to sprite collection from script, converting from data I have in prefabs?

17
Support / Re: A few questions on static sprite batcher
« on: March 11, 2014, 04:41:11 pm »
1. Add a collider in the sprite collection, that should be it. BoxColliderExtentZ and BoxColliderOffsetZ are only relevant for 3d colliders. Offset = 0 ,extent = 0.01 will work OK, 0,0will kinda work too - you should see the colliders, but they'll be flat.

That's where I am getting lost. When I would create it in editor, I understand commiting the batcher will extract colliders from game objects and merge them into mesh collider.
But when I do it from code, your sample looks like this:

Code: [Select]
for (int i = 0; i < batcher.batchedSprites.Length; ++i) {
            tk2dBatchedSprite bs = new tk2dBatchedSprite();

            // assign sprite collection and sprite Id for this batched sprite
            bs.spriteCollection = spriteCollection;
            bs.spriteId = spriteCollection.GetSpriteIdByName("crate");

            Vector3 pos = new Vector3((i - batcher.batchedSprites.Length / 2) * 0.1f, Random.value * 0.2f, 0);

            // Assign the relative matrix. Use this in place of bs.position
            bs.relativeMatrix.SetTRS(pos, Quaternion.identity, Vector3.one);

            batcher.batchedSprites[i] = bs;
        }

what I would need would be something like this:

Code: [Select]
for (int i = 0; i < batcher.batchedSprites.Length; ++i) {
            tk2dBatchedSprite bs = new tk2dBatchedSprite();

            // assign sprite collection and sprite Id for this batched sprite
            bs.spriteCollection = spriteCollection;
            bs.spriteId = spriteCollection.GetSpriteIdByName("crate");

            //specify a collider for sprite
            bs.collider = new BoxCollider();

            Vector3 pos = new Vector3((i - batcher.batchedSprites.Length / 2) * 0.1f, Random.value * 0.2f, 0);

            // Assign the relative matrix. Use this in place of bs.position
            bs.relativeMatrix.SetTRS(pos, Quaternion.identity, Vector3.one);

            batcher.batchedSprites[i] = bs;
        }

or possibility to create colliders based on sprite rectangle.

Thanks again,

Jakub

18
Support / Re: A few questions on static sprite batcher
« on: March 09, 2014, 07:28:03 pm »
Quote
1. What warning? If its the one about including all the source sprites - its likely you've moved the wrong object - make sure its the spriteCollectionData object and not the spriteCollection object.

Yes, that was it. Thanks for the tip, it helped me got it working :)

My initial tests are very promising, but I have also run into more problems:

1. How can add colliders to batched sprites, when scripting the batcher?
Building level elements from static square blocks I would like to add box collider to each sprite and then make batcher combine them for me. There fields BoxColliderExtentZ  and BoxColliderOffsetZ but I cannot figure out how to use them

2. In one case, batching a few dozen sprites resulted in doubling the draw calls needed for the scene (from 30 to 60).
Are there cases where sprite batcher could interfere with dynamic batching?

Thanks for your help!



19
Support / A few questions on static sprite batcher
« on: March 06, 2014, 10:02:46 am »
Hi,

I have just discovered feature called static sprite batcher and am trying to test it in our project (from code, not editor)
http://www.unikronsoftware.com/2dtoolkit/doc/2.00/advanced/scripting_static_sprite_batcher.html

I have a few questions on this
1.   How to load tk2dSpriteCollectionData using Resources.Load?
My tk2dSpriteCollectionData sits in Textures directory, when moved to Resources, editor reports warning.

2.   Is sprite batching help me as compared to Unity3d static batching? In other words - is it the same or something completely different?
3.   Can I dynamically allocate size of the batcher (with list), or it has to be an array?
I want to build it on the fly, using data from xml file

Thank you in advance,

Jakub

20
Showcase / Introducing Createrria
« on: March 06, 2014, 09:15:37 am »
Hi all,

My name is Jakub, I am Incuvo co-founder. We are working (using 2d toolkit, of course!) on Createrria, which turns making games into a game itself:
http://www.youtube.com/watch?v=XbeEuY1rL7M

Createrria had its initial release in December, getting ovrt 600k downloads in first month.
First big update will be released soon:
http://www.youtube.com/watch?v=U1WamP--qSc

With 2d toolkit we managed to support wide range of iOS devices, with different art resolutions and good performance.
I am just starting with this forum, expect lots of weird questions soon ;)

Cheers,

Jakub

Pages: 1 [2]