Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Orthello 2D Framework - 100% FREE

Discussion in 'Assets and Asset Store' started by mas, Jul 7, 2011.

  1. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696

    The dimensions of your sprites 'in game' dont mather. the sprite.size can be any size really. When creating images to be imported or atlasses, some devices (like iOS) sometimes expect rectangular pow2 base textures. However... when using an non pow2 atlas in a pow2 way in that case is also possible by setting the spriteAtlas.sheetSize to the correct (on disk) dimensions so Orthello will calculate the right UV mappings.
     
  2. kris8360

    kris8360

    Joined:
    Jan 11, 2013
    Posts:
    34
    Hi, can someone explain me how to do the following:

    I want my player to run always, exept when he jumps.

    So I tought this script would work:

    void Update(){
    if(character.isGrounded){
    player.Play("run");
    }
    if( ! character.isGrounded){
    player.Play("jump");
    }
    }

    But this isn't working. The problem is that, the Update function is called every frame, so the animations always starting over and over again, and it stuck at the first frame of the animation.

    Hope somebody can help. Thanks.
     
  3. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696

    check :

    - if your animation is already running using sprite.isPlaying
    - the current animationFrameset that is playing using sprite.animationFrameset

    no some smart coding and your character is all smoothy...
     
  4. kris8360

    kris8360

    Joined:
    Jan 11, 2013
    Posts:
    34
    Thank you.
     
  5. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Announcement

    version 2.7 will be released this month with :

    - ClipSprite
    Clip a sprite using a rectangular area (0,0,1,1) and a factor (0,1) linked to Pivot ( top, left, bottom , center etc )

    - ClippingAreaSprite
    Use a sprite as a clipping area linked to a specific layer ( a clipping camera is used behind the scenes) so that only sprites with that specific layer id are seen in the sprite's area. Perfect for scolling lists and clipped overlays etc etc.
     
    Last edited: Feb 4, 2013
  6. mkjrfan

    mkjrfan

    Joined:
    Aug 19, 2012
    Posts:
    38
    Hey mas I have this problem when using orthello where my character wont animate. Its an attack animation for a 2d beat'em up where it would have an animation play depending on the number of times the hit button is pressed. For some reason it works for the left side where it is able to cycle through the three animations when the hit button is pressed, but on the left side it only animates the first thing and then it doesn't animate the rest.

    This is only the attacking part of the code and if you want me to go in greater detail of what each variable is and how it works I will.
    Code (csharp):
    1. if(xa.attacking  !xa.onSkateboard )
    2.         {
    3.            
    4.             if(xa.facingDir==1){
    5.                 if (currentAStates!=xa.aStates.second  canA2==true )
    6.                 {
    7.                     print("Second Attack");//second attack
    8.                     mySprite.PlayOnce("aRight" );//Attack Left
    9.                     currentAStates = xa.aStates.second;
    10.                 }
    11.                 else if (currentAStates!=xa.aStates.third  canA3==true )
    12.                 {
    13.                     print ("Third Attack");//third attack
    14.                     currentAStates = xa.aStates.third;
    15.                     mySprite.PlayOnce("GoSL" );
    16.                 }
    17.                 else if (currentAStates != xa.aStates.first  canA2!=true  canA3!=true){
    18.                 mySprite.PlayOnce("aLeft" );//Attack Left
    19.                 print ("First Attack");
    20.                 currentAStates = xa.aStates.first; 
    21.                 }
    22.             }
    23.                
    24.             if (xa.facingDir==2){
    25.                 if (currentAStates!=xa.aStates.second  canA2==true )
    26.                 {
    27.                     print("Second Attack R");//second attack
    28.                     mySprite.Play("aRight" );//Attack right
    29.                     currentAStates = xa.aStates.second;
    30.                 }
    31.                 else if (currentAStates!=xa.aStates.third  canA3==true )
    32.                 {
    33.                     print ("Third Attack R");//third attack
    34.                     currentAStates = xa.aStates.third;
    35.                     mySprite.Play("GoSL" );
    36.                 }
    37.                 else if (currentAStates != xa.aStates.first  canA2!=true  canA3!=true){
    38.                 mySprite.Play("aLeft" );//Attack Left
    39.                 print ("First Attack R");
    40.                 currentAStates = xa.aStates.first; 
    41.                 }
    42.                
    43.             }
    44.            
    45.         }
    I know the code works because for the right side it prints on "First, second, and Thrid Attack" but it doesn't animate.
     
  7. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    @mkjrfan

    The only difference between the 2 blocks I see , is that you use mySprite.PlayOnce in one part and mySprite.Play in the other.
     
  8. mkjrfan

    mkjrfan

    Joined:
    Aug 19, 2012
    Posts:
    38
    Nevermind I figured it out. The problem was where I placed the chunk of codes. Sorry for wasting your time.
     
    Last edited: Feb 10, 2013
  9. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Good to hear you found it.
     
  10. Code_Helix

    Code_Helix

    Joined:
    Feb 21, 2012
    Posts:
    79
    I was wondering how do you get the size in the view child of the OT object to change the size of the main camera automatically as I have to manually set the size of the Main Camera as the size in the view won't change it. Is there a specific way to lonk the two together as simply adding the OT object to the scene doesn't link the two.

    Also was wondering if there will be any new tutorials on how to use Orthello that are more in depth and has pictures to help demonstrate how to do things as personally don't think the one's on the site are very beginner friendly for those who are just starting with Unity. Anyways, keep up the great work and hope to see more from you guys. :)
     
  11. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Set your OT.view.pixelPerfectResolution to your reference (work) resolution and
    OT.view.alwaysPixelPerfect to false;

    This way Orthello will always show the pixelPerfectResolution size on your device ( auto zoom )

    I am sorry to say that we do not have any other tutorials. We are thinking of starting a blog though with tips and tricks.
     
  12. Code_Helix

    Code_Helix

    Joined:
    Feb 21, 2012
    Posts:
    79
    Where exactly do I go to set that? DO I need to go into the OT scripts to do that?
     
  13. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Both the pixelPerfectResolution and alwaysPixelPerfect settings are editor (inspector) settings that you can set by selecting the OT.view object in your scene's hierarchy and changing them in your inspector window.

    Info about the orthello view can be found here...
     
  14. Rens2Sea

    Rens2Sea

    Joined:
    Feb 9, 2013
    Posts:
    7
    First of all, thanks for making the framework, it seems really nice! :D
    But i have a few questions:
    • Will there be support for a TILED polygon layer for collisions?
      For now, what is the best way to add collisions without adding shapes manually in Unity after adding a tilemap?
    • Will you update the OTTilemap documentation? It seems to miss some properties.
    Thanks!
     
  15. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    There is a OTTilemap.generateColliders setting that will generate colliders on specific tiles that have a specific 'collider' property set to the value 'collider' or trigger.

    I, indeed have to document that property. What is also missing?
     
  16. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Orthello + Pro version 2.7 released.
    • Added OTHelper with useful static functions
    • Passive is now on by default
    • Added ClipSprite
      Use this to clip a part of a sprite. It uses a local clipRect (0,0,1,1) and a pivot oriented clipFactor (0,1).
      Can be used to create fill type effects and more...
    • Added ClippingAreaSprite
      Use this sprite to clip an area on screen so that only objects with a certain layer id (int) will show within the
      world rect area of this sprite.
    Download Orthello here... | Try the clipping Demo

    9 ClipSprites with different pivot using clipFactor 0.5f and a clipRect of (0,0,1,1)


    A ClippingAreaSprite active over these ClipSprites


    Download Orthello here... | Try the clipping Demo

    The clipping demo scene can be found in /Orthello/Examples/0 - Simple Examples/Clipping
     
    Last edited: Feb 16, 2013
  17. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Orthello Form Elements released

    • Panels (can be clipped containers, or used to align to device screen )
    • Checkboxes
    • Optionboxes
    • Textinput (clipped + cursor control)
    • ListBox
    • SliderElement



    Can only be aquired on our own website ($35)

    More information | Check the demo
     
  18. TheLurkingDev

    TheLurkingDev

    Joined:
    Nov 16, 2009
    Posts:
    91
    Is this forum thread the proper place to ask general usage questions regarding Orthello?

    I am just getting started with Orthello and I trying to stop currently playing animation frameset on a AnimatingSprite and subsequently display the starting frame of the animation frameset on the AnimatingSprite. However, I am having a little trouble figuring this out. Here is the code that I have currently:

    I am basically getting three different errors with this code, all of them basically telling me that there is a type mismatch. Would you please point me in the right direction?
     
  19. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    You can not get a OTAnimationFrameSet the way you try to do it. You are using a type as a function. This is no valid code.

    However...

    The ShowFrame method on an animating sprite will show the Nth frame of the current animation frameset. Therefor ShowFrame(0) should do the trick or
    , if you want to show the first frame of a specific animation frameset, you first Play(that frameset) and next ShowFrame(0)

    I shall add a function that let you also specify the frameset when calling ShowFrame, in a next update.

    P.s. And yes.. Your questions regarding Orthello can go here..
     
  20. Aldwin

    Aldwin

    Joined:
    Feb 18, 2013
    Posts:
    12
    Hi!
    First of all, thanks for this very good Orthello and excuse me for my english (I'm french :) )...

    So, here's my problem :
    It took me a long time to finally find why, when I tried to move my AnimatingSprite with transform.position, it always came back to its initial pose... I read in your past post that I have to use sprite.position instead or turn on the "dirty checks". I was so happy and choose to turn on the dirty check in the Awake function of my player script :
    but it didn't work...
    The problem is I can't use the "sprite.position" solution because I'm using the unity character controller and the "move" method (which is calling a transform.position i guess).
    I tried to enable all the dirty checks with OT.dirtyChecks but it didn't work neither.

    Do you have any idea ? Is the character controller not compatible with Orthello ?

    Thank!
     
  21. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    There is no official support for the Unity character controller.

    you could try and set OT.dirtyChecks to true; ( will give you a cpu/fps penalty )

    In the next 'to be released' version, I will synchronize transform.position to sprite.position and
    transform.rotation to sprite.rotation when sprite.physics = rigidbody, nogravity or custom.

    if you want you can drop me an e-mail at info at wyrmtale dot com sdo I can provide you with
    my current OTObject.cs to try if that will work.
     
  22. Rens2Sea

    Rens2Sea

    Joined:
    Feb 9, 2013
    Posts:
    7
    I have noticed an issue which i could only fix by modifying the orthello source. :eek:

    I am using a TileMap to display a TILED map and it has the Generate Colliders option checked. (using the A* Pathfinding extension together with it, works great!)
    I have a Bullet object prototype which is an OTSprite with physics on Trigger and Sphere collider Is Trigger is checked.
    I also have a Monster object, also an OTSprite with the same physics settings as the Bullet.

    Now what i need is that when the bullet will collide(trigger) with the wall it will be destroyed, and against the monster it will hurt and then get destroyed.

    After a few hours of work i finally got that working but required some changes in the code.

    The entire bullet code can be seen here: http://paste2.org/p/2904312 (Minus some things that are not important right now)

    I needed to create an colliderObject property in OTObject because the tilemapCollider objects created by the TileMap are not of type OTObject so OTObject._collisionObject is always null in all the OnTrigger... and OnCollision... methods which means i could never check if the bullet (OTObject) hits a wall (colliderObject).

    Code (csharp):
    1.  
    2. void OnTriggerStay(Collider c)
    3. {
    4.    _collisionObject = c.gameObject.GetComponent<OTObject>();
    5.    _colliderObject = c.gameObject;
    6.    if (onStay != null)
    7.    ...
    8.  
    This is obviously not the way to go, so can this be fixed? Or am i just doing it completely wrong? :p (I just started with Unity about a week ago, so yeah, could be me)

    As for your question if there were more things that were not documented, i haven't found anything missing so far.
     
  23. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    The OTObject.collision will get you to your sprite's Collision object. Through this object you can find the Collision.collider and could use its name to determine if it is a wall.

    Tell me if this will work for you.
     
  24. Rens2Sea

    Rens2Sea

    Joined:
    Feb 9, 2013
    Posts:
    7
    It won't. I'm using triggers and not collisions, so the OnTriggerEnter event will be called and that one uses the Collider object, not the Collision object.
    It works fine when both objects are OTObjects, but not when one is an OTObject, and the other isn't (like a tilemapCollider).
     
  25. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I understand. Orthello will not call the OnCollision or OnEnter function when a trigger collider is being hit. I shall change that in a future version so that those methods (maybe an OnTrigger) will be called and sprite.triggerCollider will hold a reference to the collider that was hit.

    for now you could....


    - Create some custom script and attach that to your bullet.
    - In the custom script capture the regular unity event OnTriggerEnter(Collider c)

    This will give you access to the collider that was hit and also the name and gameobject.

    You should be able to suit this 'workaround' to your needs.

    Let me know if it worked.
     
    Last edited: Feb 24, 2013
  26. Rens2Sea

    Rens2Sea

    Joined:
    Feb 9, 2013
    Posts:
    7
    Yeah works fine now, i've restored OTObject back to original and and am just using void OnTriggerEnter(Collider c) now. Thanks!

    While i'm here, i have another issue.
    I have a monster spawner that spawns monsters using:

    Code (csharp):
    1.  
    2. OTSprite monster = OT.CreateSprite("Monster");
    3. monster.position = this.transform.position;
    4.  
    Works fine, however, when a bullet happens to be at position 0,0 while the monster is being spawned it seems to hit it.
    So i assume the CreateSprite call creates a monster at position 0,0, then the bullet hits it there, and then the monster's position is set.

    I've just tested this by modifying the internal OT's _CreateObject methods to accept a Vector2 for positioning:
    Code (csharp):
    1.  
    2. GameObject g;
    3. if (position != Vector2.zero)
    4. {
    5.     g = Instantiate(OTObjectType.lookup[proto], position, Quaternion.identity) as GameObject;
    6. }
    7. else
    8. {
    9.     g = Instantiate(OTObjectType.lookup[proto]) as GameObject;
    10. }
    11.  
    And this indeed solved the issue.
    I could of course also move the entire level far away from 0,0 so it's not in the level anymore, but that just seems like overkill.
     
  27. dln11

    dln11

    Joined:
    Feb 20, 2013
    Posts:
    1
    My question is , what are the steps to develop a game for multiple screen resolutions, for example for Android? I'm new on Unity and I don't know if this is a unity question or you can solve it with a framework like Orthello. Thanks!!
     
  28. rah

    rah

    Joined:
    Jan 10, 2013
    Posts:
    6
    I have a version of Orthello that contains this fix, but I still have the same problem. Here's what I'm getting with a frame-by-frame log, called from the Update() function. I've manually marked each line where the frame increments with an asterisk, and each line where the frame double-increments with a double-asterisk. The scenario here is a character idling at frame 1, then running an animation with frames 9 through 28, then returning to frame 1. I log only when the character is playing the 9-28 animation.

    Code (csharp):
    1.  
    2. Frames: 1 to 9 *
    3. Frames: 9 to 9
    4. Frames: 9 to 9
    5. Frames: 9 to 9
    6. Frames: 9 to 9
    7. Frames: 9 to 9
    8. Frames: 9 to 10 *
    9. Frames: 10 to 10
    10. Frames: 10 to 11 *
    11. Frames: 11 to 11
    12. Frames: 11 to 11
    13. Frames: 11 to 12 *
    14. Frames: 12 to 12
    15. Frames: 12 to 13 *
    16. Frames: 13 to 13
    17. Frames: 13 to 13
    18. Frames: 13 to 14 *
    19. Frames: 14 to 14
    20. Frames: 14 to 15 *
    21. Frames: 15 to 15
    22. Frames: 15 to 15
    23. Frames: 15 to 16 *
    24. Frames: 16 to 16
    25. Frames: 16 to 17 *
    26. Frames: 17 to 17
    27. Frames: 17 to 17
    28. Frames: 17 to 18 *
    29. Frames: 18 to 18
    30. Frames: 18 to 20 **
    31. Frames: 20 to 20
    32. Frames: 20 to 20
    33. Frames: 20 to 20
    34. Frames: 20 to 20
    35. Frames: 20 to 21 *
    36. Frames: 21 to 21
    37. Frames: 21 to 21
    38. Frames: 21 to 22 *
    39. Frames: 22 to 22
    40. Frames: 22 to 23 *
    41. Frames: 23 to 23
    42. Frames: 23 to 23
    43. Frames: 23 to 24 *
    44. Frames: 24 to 24
    45. Frames: 24 to 26 **
    46. Frames: 26 to 26
    47. Frames: 26 to 26
    48. Frames: 26 to 26
    49. Frames: 26 to 26
    50. Frames: 26 to 28 **
    51. Frames: 28 to 28
    52.  
    Unity was running above 60 FPS the whole time, according to the "stats" dropdown in the editor. The animation was set to 24 FPS. Frame 24 only gets two renders, which can happen based on when the frames actually render, but then Frame 25 is skipped entirely, and Frame 26 is rendered five times in a row, then Frame 27 is skipped and we go right to Frame 28.

    Is there anything else that can be done here? I'm really confused about how this can happen. Thank you in advance!
     
  29. tgarthwaite

    tgarthwaite

    Joined:
    Feb 5, 2013
    Posts:
    10
    Hello,

    Great framework, I'm making quick use of your action trees in Pro. Awesome. I just have a few questions/issues with mouse movement. I need to be able to detect when the mouse is over a non-transparent pixel in a sprite, not just anywhere in the rectangle that contains the sprite. I'm willing to do some work for it, but I can't seem to find a way to do this in Orthello.

    First off, I can get sprite.onMouseEnterOT working great, setting it to a method that takes an OTObject owner as a parameter. This fires off perfectly, and I can even use Debug.Log to output the OT.view.mouseViewPosition and OT.view.mouseWorldPosition to see the location of the mouse pointer. But, if I asign the same method to sprite.onMouseMoveOT, it never seems to fire. Nothing else has changed, I just changed to which attribute on the sprite I'm assigning the method. Any ideas why this wouldn't be firing?

    Once I get that settled, I figure that I'll be able to do some math to determine the position within the sprite for the pointer, probably between the respective x and y of OT.view.mouseViewPosition and owner.position. My next task will be to navigate from owner's OTSprite to its sprite atlas. Any tips on how to determine the alpha of a pixel within the PNG, and how to get a handle into the pixels?

    Is this even the right approach? Or should I try using custom Mesh Colliders for the sprites, using them for input?

    Thanks!

    Tim
     
  30. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I will put on my todo list to come up with a solution for this.

    Probably that the created sprite will be auto-positioned on the prototype's location. so you will have to make sure that your prototype objects are
    well out of your game world's view.
     
  31. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    In a game I am currently developing we use the low resolution graphics by default and dynamicly load and assign bigger textures ( where applicable )
    from resources when we detect a better device.
     
  32. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Can you provide me with your test application that logs the results you display?
    This way I can check what is going on.

    send it to info at wyrmtale dot com.
     
  33. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Regarding the onMouseMoveOT.. i really dont know why it should not fire .. could be a bug. I will investigate this and patch it if I find a bug. In the meantime you can detect the enter and exit so by setting a boolean you know that the mouse is over the sprite. Or you could use bool OT.Over(sprite)
    to detect if the mouse is over the sprite.

    the sprite.uv should give you the uv coordinates of your sprite on yout atlas texture.
    so you could calculate what pixel info you need.

    The alpha information should come from the pixel data array you need to load from the texture. You need to have the texture read/write enabled in the Unity texture importer to do that.

    see Texture2D.GetPixels


    To create a mesh collider for all your sprites and do a raycast is also a possibility if checking pixels should prove to be too cpu consuming but can be time costly to produce and manage.
     
  34. rah

    rah

    Joined:
    Jan 10, 2013
    Posts:
    6
    Thanks, I will get a build together now. Also, while we're here, Orthello keeps changing my framerates on my animations. It basically seems to roll back the last thing I entered, so if I type "24" into the FPS window, it changes it to "2" when I run the game. What I've ended up doing is changing it to 24, then copy-and-pasting the duration into the duration window, and then it appears to stay.
    At one point I actually went into the code and commented out the part where it recomputes fps based on duration, which fixed the problem with my framerate numbers being altered, but the bug I originally wrote about happens either way, as long as I'm playing the animation at 24 FPS.
     
  35. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I will check into the 'not holding fps bug' as well.
     
  36. tgarthwaite

    tgarthwaite

    Joined:
    Feb 5, 2013
    Posts:
    10
    Thank you! I appreciate the support. :)

    This worked great! So, now I've done the math to get the position of the pointer within the sprite, which works great, and I just need to check the color of the pixel of the frame in the sprite atlas for the OTSprite.

    I used sprite.uv as you suggested, but for some reason it doesn't seem to be giving the correct position within the atlas. sprite.texture.name gives the name of the sprite atlas, so I'm assuming that uv[0] will give the upper-left position of the sprite's frame within the atlas. So, I'm using sprite.uv[0].x * sprite.texture.width. I figured that would get the x value of the left side of the frame in the sprite atlas. Does this make sense? Because it's not coming up with the proper x or y values for that frame of the atlas - it seems to be some random position in teh atlas, unrelated to where the sprite's frame is actually located. I'm using the pointer's position in Gimp on the atlas texture to check the actual position.

    Thanks again,

    Tim
     
  37. tgarthwaite

    tgarthwaite

    Joined:
    Feb 5, 2013
    Posts:
    10
    FYI, I had luck with setting the FPS, then copying the calculated duration and pasting it back into the duration, and saving, as a work-around to this bug. Then the FPS value sticks.

    Cheers,

    Tim
     
  38. tgarthwaite

    tgarthwaite

    Joined:
    Feb 5, 2013
    Posts:
    10
    Hello,

    One more small issue.

    I've got a controller with two actions, "Spin" (Rotate 1080, 0, 1.5, StrongIn) and "Shrink" (Size 0, 1.5f, StrongOut), and a tree called "Animate" that is Action("Spin").And("Shrink"). The shrink is working, but not the spin. If I change the tree to Action("Shrink").And("Spin") I get the same behavior - shrink works, but not spin. If I remove the shrink, the spin works great. Are rotation and size tweens mutually exclusive for some reason?

    Thanks,

    Tim
     
  39. rah

    rah

    Joined:
    Jan 10, 2013
    Posts:
    6
    I found that too, but I had to keep on doing it. Eventually (not in the build where I discovered the bug I reported earlier) I just went into the code and disabled the automatic FPS calculation.
     
  40. rah

    rah

    Joined:
    Jan 10, 2013
    Posts:
    6
    Regarding the issue I posted earlier, frames being doubled or skipped at 24 FPS, with mas' help I was able to fix it in my test case.

    Line 195 of OTAnimation.cs should be changed to read:

    Code (csharp):
    1.  
    2. index = (int)Mathf.Round((float)fc * (time / GetDuration(frameset)));
    3.  
    The only change there is the Round() call used to be a Floor() call, and at certain framerates, the fractions weren't quite getting over the edge into the next frame. There may still be inaccuracies over really high frame numbers, but I think it would have to be so much that the roundoff adds up to more than half a frame in magnitude.

    I don't know if this has any weird side effects elsewhere, but if you're in my position of using 24 FPS animations instead of 10, 20, 30, etc., then this might help you. Thanks again to mas for giving us Orthello in the first place, and for helping me find this tricky bug!
     
  41. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Thank you for finding this bug!
    I will be finding a fix for the 'setting fps/duration' bug soon.

    In my version the line is found on line 190 instead of 195 by the way.

    UPDATE

    I took a better look at the original code that does a Floor instead of a round. And although is solves your issue, the floor should be in there.

    If not, the first frame will only play for half the time it should ( half way it is rounded up to frame 2 ) and half way the last frame it will round to a non existing frame, that will be taken back to frame 0.

    This is not what should happen.

    I think this need to have more investigation. For now I am not putting it in.
     
    Last edited: Feb 28, 2013
  42. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I am investigating it.
     
  43. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Mmm. maybe using sprite.uv is not such a good thing, because it is dependend on flipH and flipV and the array is related to the vertices that can be different in some sprites that have more than 4 vertices.

    did you check into

    RaycastHit.textureCoord ?

    When using OT.Over, OT.hit should hold the RayCastHit and
    OT.hit.textureCoord should have its coordinate on the texture.

    !IMPORTANT The sprite.physics should be set to custom so you can attach a MeshCollider ( else it wont work )
     
    Last edited: Feb 28, 2013
  44. TheLurkingDev

    TheLurkingDev

    Joined:
    Nov 16, 2009
    Posts:
    91
    I am using the following line to destroy a static sprite:
    This is removing the sprite from the Scene View, but in the hierarchy panel I keep seeing "sprite-1", "sprite-2", "sprite-3", etc. each time I instantiate the sprite and these are not removed. These are not appearing beneath the OT object and the only things I see in it when I select one in the Hierarchy panel are a Mesh Filter component and a Mesh Renderer component. The Mesh Renderer component contains the Texture that I assign to the sprite's Image via code (the Texture is a public variable that I drag the image to at design time). How do I get rid of these?
     
  45. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Orthello uses auto object pooling.

    This means that objects (sprites) that are destroyed using OT.DestroyObject(sprite) are put back into the pool of objects to be re-used.

    If you would want to really destroy the entire object so it will never come back you use

    Code (csharp):
    1. Destroy(sprite.gameObject);
     
  46. TheLurkingDev

    TheLurkingDev

    Joined:
    Nov 16, 2009
    Posts:
    91
    I would like to use the auto object pooling, but from what is appearing in the Hierarchy panel at runtime it looks like a new object is instantiated every time instead of reusing a previously deleted object.

    Here is the code creating the muzzleFlash:
    Code (csharp):
    1. OTSprite spriteMuzzleFlash = OT.CreateObject(OTObjectType.Sprite).GetComponent<OTSprite>();

    And, again, here is the line destroying the object:
    Code (csharp):
    1. OT.DestroyObject(spriteMuzzleFlash, (float)0.05);
    This is successfully removing the sprite from the scene view and I see that a single "sprite" is placed under ObjectPools. However, every time the OT.CreateObject method is called a new sprite-# instance is created (sprite-1, sprite-2, sprite-2). Is this the way it is supposed to behave? I expected that the same object would be deleted and recreated over and over.
     
  47. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Hi,

    Frist of all, thanks for this nice product and lightspeed support.

    I'd like to have a button in the left-botton for the screen. So, i created Form, Panel (as a child) and button (as a child of Panel). Right after creation, Button is goddamn large, so i added Panel2 to compensate scaling of the Panel.
    Now it is looking like Form/Panel/Panel2/Button

    It works, but is it a proper way? But if i'll change size (scale) of the Panel, i'd be needed to change the size of Panel2 (still better than changing of all button's sizes, but not sure if it is the best solution).


    Second question. I want to move panel (with button) the the right bottom corner for any resolution. But in panel's properties i see only Align: Bottom, Left, Center, etc, but i dont see LeftBottom.
     
    Last edited: Mar 3, 2013
  48. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    I usually do not use the OTObjectType.#### to create an instance of a 'pooled' sprite. My workflow is forst creating a prototype configured sprite and put that in the scene's hierarchy under OT.Prototypes. I than create an instance using OT.CreateSprite("prototypeName"); I never stumbled upon a pooling error so it could be OTObjectType.#### related.

    Try setting a regular prototype in you scene and see if that improves stuff.

    I will put on my todo list to check the auto creation and destroying of the basic OTObjectType.##### elements.

    PS. You can prefabricate a pool of objects (for quicker instancing) using OT.Prefabricate(...);
     
  49. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Theoreticly .. you would only need one Panel, aligned to bottom an stretched, with childs alignment left.

    Could be that OTElements and OTFormElements do not have the same size approach, but you can just downsize your OTButtonElement scaling the button element itself or scaling all sub-elements of a button element. I would not use a panel to compensate for scaling but just scale the button in the editor.
     
  50. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Thanks for really fast answer, as always :)

    So, is it planned to have OTFormElementButton, or something?
    I mean, if i'd have a dozen of buttons, and would add one more button - then i'd need to rescale panel itself + all dozen of buttons?

    PS: as far as i remember, in NGUI there's a button in every child element, which allows to reset scaling. Or to keep element's own constant scale, i dont remember exactly.

    PPS: another thing what i'd like to have is possibility to set line's start and end points as sprites.
     
    Last edited: Mar 3, 2013