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. test29

    test29

    Joined:
    Apr 12, 2013
    Posts:
    6
    I found how to use it, but that is not what I need.

    My problem is:

    In View I set PixelPerfectResolution to 480x800.
    When I put sprite on screen on to (example) x=200, y=200, it will stay at the same position no matter what device I tried (it will stay at same position on screen on devices with resolution 480x800 and on device with resolution 1080x1920). And that's good thing.

    My problem is that when I need to read touch position (or mouse click position) it will change according to resolution of device (it will not calculate touch position to resolution I set (480x800)), I mean when I touch sprite on x=200, y=200 it will read different x and y position according to resolution of device, it will not return x=200, y=200).

    Is there a command that will return x and y touch position based on resolution I set in PixelPerfectResolution, not based on resolution of device.

    Thanks.
     
  2. test29

    test29

    Joined:
    Apr 12, 2013
    Posts:
    6
    I found what I needed.
    It's command - OT.view.mouseWorldPosition

    It would be great if there is a dedicated forum for Orthello.
     
  3. 9a3eedi

    9a3eedi

    Joined:
    Jun 30, 2013
    Posts:
    3
    Hi,

    I'm new to Unity and Orthello, but I've previously written other games from scratch and used other engines. I've followed an excellent online video tutorial on Orthello and I seem to understand most about how it all works, but I have a few questions still.

    1. Is there any way to have the camera render using orthographic for the 2D stuff, then switch to perspective to render 3D models? I'm trying to go for a 2.5D look. I understand that OT does not support rendering in perspective, but I was wondering if this could be manually be done in code somehow.

    2. Is it ok to use pixel shaders with Orthello?

    That's all I got, thanks.
     
  4. Mister-E2

    Mister-E2

    Joined:
    Jun 6, 2013
    Posts:
    179
    Hi, I added the following static function to OTTween, controller was already static so it made sense:

    Code (csharp):
    1.  
    2.     public static void StopAllTweens(bool allRunning = true, bool allWaiting = true)
    3.     {
    4.         if(controller != null)
    5.         {
    6.             controller.ClearAllTweens(allRunning,allWaiting);
    7.         }
    8.     }
    9.  
    10.  
    Then is the ClearAllTweens function in controller:


    Code (csharp):
    1.  
    2. public void ClearAllTweens(bool allRunning, bool allWaiting)
    3.     {
    4.                 //if both are true we want everything gone
    5.         if(allRunning  allWaiting)
    6.         {
    7.             tweens.Clear();
    8.             return;
    9.         }
    10.                 //make sure both can't be false
    11.         if(allRunning != allWaiting)
    12.         {
    13.             //If this is true it means allWaiting is false, and vice versa
    14.             if(allRunning)
    15.             {
    16.                 //remove all tweens that are currently running
    17.                 for(int i=0;i<tweens.Count;i++)
    18.                 {
    19.                     if(tweens[i].isRunning)
    20.                     {
    21.                         tweens.RemoveAt(i);
    22.                     }
    23.                 }
    24.                
    25.             }
    26.             else
    27.             {
    28.                 //remove all tweens that are currently waiting to start
    29.                 for(int i=0;i<tweens.Count;i++)
    30.                 {
    31.                     if(tweens[i].WaitTime > 0)
    32.                     {
    33.                         tweens.RemoveAt(i);
    34.                     }
    35.                 }
    36.             }
    37.            
    38.         }
    39.         else
    40.         {
    41.             Debug.Log("Attempted to clear tweens but parameters specified not to");
    42.         }
    43.        
    44.        
    45.        
    46.        
    47.     }
    48.  
    This code works fine in my current project so maybe it is good for you also. Thanks
     
  5. IndreamsStudios

    IndreamsStudios

    Joined:
    Jun 4, 2013
    Posts:
    9
    Hi, I'm trying to ensure a certain z-ordering of sprites in my scene. Whenever I try to change the transform.z in the Inspector, it does not let me. If I disable the OTSprite component then I can, but enabling the OTSprite forces it back. Is there some value on OTSprite that can adjust this, or something on OT that will stop trying to override me on this setting?

    Thanks
     
  6. 9a3eedi

    9a3eedi

    Joined:
    Jun 30, 2013
    Posts:
    3
    @IndreamsStudios

    I'm new to Orthello, but I think you can do that simply by setting the "Depth" in OTSprite.

    Hope that helps.
     
  7. Scunder

    Scunder

    Joined:
    Jul 2, 2013
    Posts:
    1
    Hi, I've been looking online for answers to this but I can't seem to find any.

    Whenever I load a scene or bring a prefab in that uses orthello, each sprite will alternate between 90, 180, 270 or 0 degrees on creation. I'm trying to make a frame for a grid based game and have 4 corner sprites and 4 sprites that connect each corner sprite to the other. Has anyone come across orthello changing the sprites position and rotation before? Any help would be greatly appreciated.
     
  8. Avestas

    Avestas

    Joined:
    Jun 8, 2013
    Posts:
    17
    Heyho :)

    Small question, on wyrmtales, there is the option described, to align the text in OTTextObjects left or right, but i can not figure out how :S

    What I want to to is making a textblock, where the letters appear one after another. This works fine, but at the moment, the first letter starts in the middle and is "pushed" left by the following ones. I want the first letter to start at a certain point and the others are added right hand side of it :D


    Vorthos


    EDIT: I am little bit embarrassed , I always find the solution 1 minute after I post something, but there was no solution to find via google, so I'll post it, instead of deleting my post:

    To align the text, the pivot point has to be changed, that's it :)
     
    Last edited: Jul 3, 2013
  9. m_eilers

    m_eilers

    Joined:
    Jul 3, 2013
    Posts:
    13
    2 Orthello questions:

    What would be the settings for an object which is both Draggable and Collidable? Currently if both are checked, the sprite will not drag at all unless you change the physics type from Trigger to Rigidbody, but of course that gets Unity involved and now my sprites randomly drift off to wherever. If I use the OnDrag example scripts, I get dragging but no collision despite the Collidable or Depth settings. How to do both at the same time?

    Also, has anyone found the "sweet spot" settings for getting Orthello set up with a 1:1 pixel view for 1024x768 (iPad 2, 1st-generation Android). I have searched here but iPad produces too many hits for me to comb through. What is a good camera size and distance from 0,0,0?
     
  10. IndreamsStudios

    IndreamsStudios

    Joined:
    Jun 4, 2013
    Posts:
    9
    @9a3eedi

    I tried what you suggested, unfortunately that changes the depth of the collider rather than the draw depth of the texture for the OTSprite.
     
  11. Mister-Esquared

    Mister-Esquared

    Joined:
    Jul 11, 2012
    Posts:
    22
    Big problem with setting sprites in code. I have a grid of custom objects which each create an OTSprite gameobject when I call an initialise function. I am attempting to set the sprites container and frame inside this initialise function. If I just pass in a single texture and apply them to the sprites everything works fine. But trying to use the spriteatlas to set the correct image causes some very weird results.

    When I set size using the size property, and I print that value out,it prints the proper size, but when the game is running the sprites are too large, but when I then complete a puzzle and it resets everything, the sprites are the correct size.

    This can't have anything to do with how I am writing code as it works fine with just a single texture like I said. So it may be that I am setting the image wrong from the atlas.

    I have also found that inside my first initialise function, which is run the first time the game is loaded, I print out the frameCount of the container and it is 0, on the re-initialise function which is called every time I complete a level the frameCount is as it should be. I checked if(OT.ContainersReady()) also and in the first initialise it is false. Both initialise functions contain exact code apart from creating the OTSprite object inside the first one.

    So with this in mind, it seems I am using the sprite atlas correctly and it is just something in orthello which is not being set quick enough? ( my initialise function is first called within a start function of my main game class)

    Extra info:
    my objects are parented to an empty gameobject.
    I parent them before scaling them.
    It all works fine when not using an atlas
     
  12. Scorr

    Scorr

    Joined:
    Jul 2, 2013
    Posts:
    73
    Hello,

    Sorry if this question has been asked before, there does not seem to be a "search thread" function. Is there a way to rotate the Orthello camera to be x/z instead of x/y? I am making a top down game and while it wouldn't affect gameplay if the camera is vertical, it makes it easier for me knowing y is up instead of north. If there is, could world bounds be set to x/z too instead of x/z?

    EDIT: I've just settled for a vertical camera. However after some editing any new sprites I place need to be at scale/size 96x96 or else they're too small to display, while the sprite I placed before has 1x1 scale and displays fine. If I copy that one, the pasted one has to be 96x96 too. I think it may have something to do with the camera depth being -1000, but when I try to change that and hit play it resets. What's my problem?
     
    Last edited: Jul 6, 2013
  13. Mister-E2

    Mister-E2

    Joined:
    Jun 6, 2013
    Posts:
    179
    This was me 2 posts up^^

    Update though: I started a tween in my Initialise which was delayed for 0.1 seconds and it fixed it. lol. I really don't like it
     
  14. Durobot

    Durobot

    Joined:
    Jul 7, 2013
    Posts:
    3
    Hello, guys!
    Sorry if it has been discussed before, I couldn't find the answer.

    I must be doing something wrong, but I just can't figure out, have been bashing my head against this for several days, just can't find the answer, please help! :(

    I want to make a jumping animated .. ball (well, actually a pillow, but it doesn't matter now).
    So there have to be
    a) Up and down jumping animation and
    b) Different sprite animations depending on current position of the sprite - make it squashed as it hits the ground, relaxed as it goes further up and stretched up near the top of it's jump.

    I use OTAnimatingSprite for the ball, Unity animation to move it up and down, and Update function to check for the current position of the ball and switch between animation framesets (I now have just three frames - one for "Squashed" animation, one for "Stretched" and one for "Relaxed").

    And no, I can't just pre-synchronise these two animations (up-down and the switching of framesets), because I want to be able to change jumping speed dynamically.

    Here's the code more or less (many portions are for testing, commented our and/or butchered, but it doesn't help):

    Code (csharp):
    1. #pragma strict
    2.  
    3. private var sprite : OTAnimatingSprite;        // This sprite object
    4. enum JumpAnimPhase
    5. {
    6.     Squashed,
    7.     Relaxed,
    8.     Stretched
    9. };
    10.  
    11. private var myTime : Number = 0.0;
    12.  
    13. private var animPhase : JumpAnimPhase = JumpAnimPhase.Squashed;
    14.  
    15. // Use this for initialization
    16. function Start()
    17. {
    18.     // Get this star's sprite class
    19.     sprite = GetComponent("OTAnimatingSprite");
    20.     // Because Javascript does not support C# delegate we have to notify our sprite class that
    21.     // we want to receive notification callbacks.
    22.     // If we have initialized for callbacks our (!IMPORTANT->) 'public' declared call back
    23.     // functions will be asutomaticly called when an event takes place.
    24.     // HINT : This technique can be used within a C# class as well.
    25.     sprite.InitCallBacks(this);
    26.    
    27.     //sprite.PlayOnce("Squashed");
    28.    
    29.     // Make all animations in this character play at half speed
    30.     for (var state : AnimationState in animation)
    31.         state.speed = 0.2;
    32. }
    33.  
    34. // Update is called once per frame
    35. function Update()
    36. {
    37. /*
    38.     myTime += Time.deltaTime;
    39.     if(myTime > 1.0)
    40.     {
    41.         myTime = 0.0;
    42.         switch(animPhase)
    43.         {
    44.         case JumpAnimPhase.Relaxed:
    45.             sprite.PlayOnce("Squashed");
    46.             animPhase = JumpAnimPhase.Squashed;
    47.             break;
    48.         case JumpAnimPhase.Stretched:
    49.             sprite.PlayOnce("Relaxed");
    50.             animPhase = JumpAnimPhase.Relaxed;
    51.             break;
    52.         case JumpAnimPhase.Squashed:
    53.             sprite.PlayOnce("Stretched");
    54.             animPhase = JumpAnimPhase.Stretched;
    55.             break;
    56.         }
    57.     }
    58. */
    59. /*
    60.     if(Input.GetKeyDown(KeyCode.Space))
    61.         sprite.PlayOnce("Relaxed");
    62.     else if(Input.GetKeyDown(KeyCode.Return))
    63.         sprite.PlayOnce("Squashed");
    64.     else if(Input.GetKeyDown(KeyCode.Backspace))
    65.         sprite.PlayOnce("Stretched");
    66. */     
    67.     if(sprite.position.y < 5)
    68.     {
    69.         if(animPhase != JumpAnimPhase.Squashed)
    70.         {
    71.             sprite.PlayOnce("Squashed");
    72.             animPhase = JumpAnimPhase.Squashed;
    73.             //print("Squashed, y = " + this.transform.position.y);
    74.         }
    75.     }
    76.     else /*
    77.         if(transform.localPosition.y < 5.0)
    78.         {
    79.             if(animPhase != JumpAnimPhase.Relaxed)
    80.             {
    81.                 sprite.PlayOnce("Relaxed");
    82.                 animPhase = JumpAnimPhase.Relaxed;
    83.                 print("Relaxed, y = " + this.transform.position.y);
    84.             }
    85.         }
    86.         else */
    87.             if(animPhase != JumpAnimPhase.Stretched)
    88.             {
    89.                 sprite.PlayOnce("Stretched");
    90.                 animPhase = JumpAnimPhase.Stretched;
    91.                 //print("Stretched, y = " + this.transform.position.y);
    92.             }
    93.    
    94.     print("Time = " + Time.time + " OTObject's y = " + sprite.position.y);
    95.     //print("Transform y = " + this.transform.position.y);
    96.     //print(transform.position.y);
    97. }
    98.  
    99. // OnCollision callback function is called when star collides with another 'collidable' object
    100. // HINT - OnEnter and OnCollision callbacks are called exactly at the same time, the only
    101. // difference is their naming convention
    102. public function OnCollision(owner : OTObject)
    103. {
    104. }
    105.  
    106. // OnStay callback function is called when star enters (overlaps) another 'collidable' object
    107. // !IMPORTANT - This sprite's collidable setting has to be true otherwide
    108. // collision delegates will not be called
    109. public function OnStay(owner : OTObject)
    110. {
    111. }
    112. // OnExit callback function is called when star no longer overlaps another 'collidable' object
    113. public function OnExit(owner : OTObject)
    114. {
    115. }
    116.  
    The problem is with the ball's position - I just can't receive reliable y coordinate, no matter what! It just gives me weird readings, like one frame y = 5.00179, the next - 0.1062366, the next - 0.1062366 again, and the next - 5.167789. Strangely, this only happens with y around or below 5, so when the ball is higher I can see my "Stretched" animation normally, but my "Relaxed" jerks between "Relaxed" and "Squashed" because of this.

    I have tried using transform.position.y and transform.localPosition.y, it's all the same. Orthello's OTObject.position.y wasn't of any help either - the effect is the same (sadly). And when I tried changing my Unity animation curves to affect Orthello's position instead of the transform, the sprite stopped moving. Strangely, I can see Orthello position changing in the inspector as I playtest it, but my printouts just give me the same y in the console.

    I'm totally lost :(

    Oh, and one more thing - as you can see in the code, I have been testing sprite animations themselves (using keypresses, timer), thought there was something wrong with them. But they look fine, for one-frame animations at least :)
     
  15. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Good that you have found it. and good luck creating your game.
    a Orthello forum is not on our todo short list.
     
  16. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Thanks for contributing and improving Orthello. I will defenitly put it in!
    Others can expect this in a next update.
     
  17. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    1. set OT.world to world3D .. or use a 2ndr camery ontop of your Orthello camera.

    2. yes .. you can expand the material references system and add your own custom (light sensitive if you will) shaders.
    check http://www.wyrmtale.com/orthello/using-OT#materials
     
  18. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Orthello controls the vertex z value using the sprite.depth and a (x/y related painter algorithm)
    so

    use sprite.depth to set the order.
    ( you can disable the painterAlgorithm by setting OT.painterAlgorithm to false)
     
  19. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    There is no known issue that does this .. are you sure you are not rotating the sprites your self by code?
    Also .. use the orthello prototype system to OT.CreateSprite your sprite instances.
     
  20. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    If you want to check collision triggers without rigid bodies, you only need to set draggable to true (it will auto check register input and create a colliders for you) and do not need to check collidable (that will hook up a rigid body for Unity collisions).

    Dont know on the 1x1 .. I always use the 1 unit = 1 pixel (orthello default) myself ;)
     
  21. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    If your collider's depth changed, you did not set sprite.depth but sprite.collisionDepth.
     
  22. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Can you send me a package with an example scene that demonstrates the error, this way I can have a look and maybe fix it.
    send it to info at wyrmtale dot com
     
  23. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Send me a package with the faulting scene and instructions on how to reproduce on info at wyrmtale dot com. I will take a peek and see
    if I can find the cause...
     
  24. Durobot

    Durobot

    Joined:
    Jul 7, 2013
    Posts:
    3
    First of all, Martijn, thank you for the prompt reply, and for the proposal to take a look at my code!
    Now, that's what I call support! :-D

    Regarding the package - I'm not sure how to export parts of Unity projects, so let me just give you the project instead :)

    https://docs.google.com/file/d/0B_OzfKrbvG2_WE5OUnBmRERna1E/edit?usp=sharing

    In order to reproduce - just run the project inside Unity, you'll see it.

    Also, while trying to reduce archive size, I have deleted the contents of Library/metadata folder, and then opening the project caused Unity
    to re-import everything. Et voila! The animations are now switched correctly!

    But wait, I thought. Let me try to re-create the project from scratch. What would happen then?
    As it turns out, nothing good - the animations are switching sporadically just like before.
    Here's the new project:
    https://docs.google.com/file/d/0B_OzfKrbvG2_Mzd2V0g1OWd5WUk/edit?usp=sharing

    But what if I delete metadata again? Nope, still jerking and twitching :(


    Oh, and another weird thing, but now it's with Unity rather than Orthello - my (Unity) animation runs at like x10 speed, I have to make one cycle from 0 to 1:20 to make it last actually 2 seconds (or so).

    Oh well.
     
    Last edited: Jul 8, 2013
  25. Avestas

    Avestas

    Joined:
    Jun 8, 2013
    Posts:
    17
    Hey Martijn, I finally found the solution for my artifact problem, and want to share it with you, if someone else encounters it:

    As described earlier, I have had these strange lines between my tiles. To get rid of them, it really was a matter of their resolution.
    While zooming in, the artifacts disappeared, and vice versa. I was using 640*640 sprites on a 1136*640 screen, which Unity did not like, I do not know why. By changing the resolution to 320*320, the artifacts completely disappeared for my camera distance.

    I hope this will help you a little bit and thanks for all your support!


    Vorthos, or Avestas, I think this is my actual name in the forums^^
     
  26. CrossRiverGames

    CrossRiverGames

    Joined:
    Jul 8, 2013
    Posts:
    15
    I'm having a bit of trouble getting a collision between two Orthello sprites to be detected. I tried putting first the Unity OnCollisionEnter function and, after that didn't work, the Orthello onCollision function in my custom sprite code file (inheriting from OTSprite) and the collision isn't detecting. I'm sure that I'm missing something here, but I'm new to both Orthello and Unity itself. Does anyone have any ideas about what I should be doing to get the collision to be detected?
     
  27. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    When using OnCollision make sure :

    - Both sprites have sprite.collidable set to true
    - Both sprites have the same sprite.collisionDepth ( layer of their colliders )
    - using sprite.collidable will use a rigid body.

    or

    - Both sprites have sprite.registerInput to true
    - Both sprites have the same sprite.collisionDepth ( layer of their colliders )
    - without a rigid body but with a collider check collision using OnEnter instead of OnCollision.
     
  28. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Thanks for sharing!
     
  29. Durobot

    Durobot

    Joined:
    Jul 7, 2013
    Posts:
    3
    For the record - we've had an email exchange with Martijn.
    He had found the following:
    1) It's a bug in Orthello - it doesn't like one-frame animations very much;
    2) A workaround is to call sprite.ShowFrame(0) after each call of sprite.Play.

    So there. Thanks again, Martijn!
     
  30. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    This bug will be squashed and patched in a next update.
     
  31. tgarthwaite

    tgarthwaite

    Joined:
    Feb 5, 2013
    Posts:
    10
    Pre-Caching Animations?

    Hi Martijn,

    We have a few very large sprite animations, 1920x1080 pixels with a dozen frames or so. I implemented them by creating a Cocos2D container for each frame (textures imported at 2048x2048), creating a single Animation with a frameset for each frame (pointing at index zero in the appropriate container), pointing an OTAnimatingSprite at the Animation, and calling Play(). The first time they are played within a game, they seem to hesitate - they're a bit jerky. But on subsequent runs, we get the nice, smooth 30 fps animation we expect.

    Obviously, once the animation is played, something is cached, which is not precached before it is played. Do you have any idea where in the code this caching takes place? Is there any way to precache the assets or game objects so that they will play smoothly on the first run?

    Thanks,

    Tim @ 32k Studios
     
  32. tgarthwaite

    tgarthwaite

    Joined:
    Feb 5, 2013
    Posts:
    10
    If I play the animation while the opaque load screen is still in front of all other assets, would playing the animations once through each cache them? Or would they not actually play (cache) due to any sort of animation culling? I'll do some testing locally, but as the author, I was hoping you'd have some insight that could save me some time.

    Thanks!
     
  33. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    There is an caching system within the OTAnimatingSprite that initializes all animation frames , so that no timing related frame lookup code should be performed when playing the animation.

    this takes place in the method InitAnimation(), the last 2 lines of code. I can imagine , that if you have lots of frames, that this can hold cpu.

    If you improve on the code, let me review your changes so I can put it into the core if it is solid.
     
  34. citizen_12

    citizen_12

    Joined:
    Jun 21, 2013
    Posts:
    33
    I am procedurally adding OTSprite objects to my scene and experiencing an unfortunate perf problem that seems to make object instantiation run in O(n^2) time.

    It seems that every time you instantiate an OTObject the Awake function does an OTObject.CheckName(), which in turn calls GameObject.Find(). GameObject.Find is notoriously slow, so even adding a couple hundred objects results in unacceptably slow instantiation times.

    You can see from the image below that the time spent in CheckNames GameObject.Find goes up dramatically as the code adds a couple hundred OTSprite objects.

    $perf.png
     
  35. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Good find! ... I will set this on the top of my 'to improve' list for the next update.
     
  36. citizen_12

    citizen_12

    Joined:
    Jun 21, 2013
    Posts:
    33
    Is there an API that will enable me to convert from an Input.mousPosition or dragTouch.position to coordinates within an OTSprite? I have a sprite onto which I am dropping other OTObjects and I want to know where exactly on the sprite I am dropping. I also need to know the actual size of the target sprite so I can normalize the drop location (from pixel coords to a 0-1 range). The idea is for it to work in a really small editor player window or a large android tablet. I have set my Pixel Perfect resolution for my OTView to 1200x1920. I have NOT set Always Pixel Perfect.
     
  37. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    you can get the dimensions of a sprite in world coordinates usg sprite.worldRect

    there is a property : OT.view.mouseWorldPosition that has the actual world coordinates of your mouse cursor.

    these should set you off calculating.
     
  38. niparasc

    niparasc

    Joined:
    Jul 18, 2013
    Posts:
    4
    Hello,

    I am trying to create an object using OT.CreateObject("TestObject") but without success.

    I manually created an empty game object called TestObject and then I created a prefab out of it. In a test script I placed the following code inside Start():

    The debug returns NULL if my TestObject is inside the scene but outside OT-->Prototypes. If I place the TestObject inside OT-->Prototypes I get the following exception:

    I also edited the OT object prototypes adding the test object but I get the same exception.

    Could you tell me what could be the problem? According to Orthello documentation the OT class can be used to create non-Orthello objects:

    Thank you,

    - Nikos
     
  39. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    in the editor properties of the OT main object in your scene you will have to extend the objectPrototype Array add your element and link your prefab to that element.

    There is no known issue with that construct at this time so it should work.
     
  40. niparasc

    niparasc

    Joined:
    Jul 18, 2013
    Posts:
    4
    Unfortunately I keep getting the same exception even though I have added the prefab to the objectPrototype Array of OT main object. Tracing the problem in the source code of OT I was wondering why null check is missing from the following piece of code:

    Code (csharp):
    1.  
    2.  
    3. void _RemoveObject(OTObject o)
    4.     {
    5.         if (objects.Contains(o))
    6.         {
    7.             string lname = o.name.ToLower();
    8.             if (lookup.ContainsKey(lname))
    9.                 lookup.Remove(lname);
    10.             if (objects.Contains(o))
    11.                 objects.Remove(o);
    12.             if (inputObjects.Contains(o))
    13.                 inputObjects.Remove(o);
    14.             if (persistantObjects.Contains(o))
    15.                 persistantObjects.Remove(o);
    16.         }
    17. #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
    18.         o.gameObject.SetActiveRecursively(false);
    19. #else      
    20.         o.gameObject.SetActive(false);  <-------------------- Exception here
    21. #endif
    22.     }
    23.  
    24.  
    The exception happens on line 2834. What could I be doing wrong?

    Thank you

    - Nikos
     
  41. Mister-E2

    Mister-E2

    Joined:
    Jun 6, 2013
    Posts:
    179
    My sprites are taken from a frame of a sprite container and when I set the size using sprite.size = new Vector2(x,x); It seems to "add a half" to the size it should be.

    So, in the scene view, my SpriteSheet container contains many images, the image I am using has a size of 150, and a frame size of 150. In code I am setting this dependent on resolution, but for instance say the calculated size should be 75. Orthello is then setting the final size to be 112.5 (75 + (75/2)). Is there a way to stop this happening?
     
    Last edited: Jul 19, 2013
  42. Avestas

    Avestas

    Joined:
    Jun 8, 2013
    Posts:
    17
    Good evening, I got another question:

    I am now testing animations, but when I put an animatingSprite at a specific position, and make it a child of another object, the animatingSprite's position changes, when I start the game. It seems, that the position fields in the attached OTAnimatingSpriteScript do not convert to a relative position according the parent, but instead apply the former absolute position to the relative one, which kicks my sprite far away :S

    Any ideas? :)

    EDIT: Another problem I face it, that when I rotate the Sprite vie FlipHorizantal, the animation has a bug, on a certain frame, the sprite jumps more oder less slightly to the left. This does not occur, when the sprite is not rotated. :S


    Avestas
     
    Last edited: Jul 20, 2013
  43. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    i can not give you a reason why the null check is not there.. Sloppy me I guess.
    put it in at the top en let us know if that fixed it.
     
  44. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Sounds like a genuine bug. Can you create an example package that demonstrates this and send it to us by email : info at wyrmtale dot com
    we will dive in and try to create a fix.
     
  45. citizen_12

    citizen_12

    Joined:
    Jun 21, 2013
    Posts:
    33
    I am trying to use OTSpriteBatch.RemoveSprite as described on your docs. Unfortunately it does not seem to work. Even though I am calling RemoveSprite, the sprite remains a child of the containing OTSpriteBatch object. In fact, looking at the code reveals that the second parameter "newParent" is ignored by the code.

    Am I missing something?
     
  46. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Sometime ago I added a spriteBatch.AddSprite, that will add a sprite to the batch and still keeping its original hierarchy's position, the removesprite was adjusted accordingly and I have forgotton also to support the 'old' parent-child way.

    so...

    can you try and adjust the code in RemoveSprite ( line 732 )
    to

    Code (csharp):
    1.    
    2.    if (linked.Contains(sprite))
    3.        linked.Remove(sprite);
    4.    else
    5.        sprite.otTransform.parent = newParent.transform;
    6.  
    and see if that works for you?
     
  47. CrossRiverGames

    CrossRiverGames

    Joined:
    Jul 8, 2013
    Posts:
    15
    I apologize for taking so long to respond.

    I checked to make sure that both sprites have Collidable checked, have Collision Depth set to the same value, and that I'm using the OnCollision method. All of that appears to be in order. However, as this clip of the Game view shows, the player sprite passes right through the word sprite, despite the fact that they were supposed to collide.

    [video=youtube_share;8gqgRwsE3Bc]http://youtu.be/8gqgRwsE3Bc

    The settings for the word sprite are as follows:
    $word.jpg

    And the settings for the player sprite:
    $player1.jpg $player2.jpg

    Finally, the code that should execute when the sprites collide is the following OnCollision routine on the player's Player script:
    Code (csharp):
    1.     public void onCollision(OTObject owner)
    2.     {
    3.         if(collision.collider.tag == "Obstacle")
    4.             speed = 0f;
    5.     }
    There is a breakpoint on line 3. The breakpoint is not hit, even though the word sprite is of tag Obstacle.

    I'm still sure that I'm doing something wrong, but I still don't know what it is.
     
    Last edited: Jul 22, 2013
  48. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Can you send me your example project .. to info at wyrmtale dot com .. so I can have a look?
     
  49. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Did this happen when running your game or are you procedurally adding sprites in the editor environment?
     
  50. niparasc

    niparasc

    Joined:
    Jul 18, 2013
    Posts:
    4
    Yes, placing a null check there fixes the problem.