Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v6.1 : auto scrolling levels, and more]

Discussion in 'Assets and Asset Store' started by reuno, Dec 18, 2014.

  1. sofianehamza

    sofianehamza

    Joined:
    Feb 13, 2017
    Posts:
    10
    Hello, I purchased the corgi engine yesterday. it seems to be an excellent tool with a lot of usable scripts
    still, I m having an issue with a 3d character that faces the wrong side when I use it on a corgi 2d level and hence walks sideways.. when I rotate the prefab it walks the opposite side and then falls
    thanks in advance
     
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @sofianehamza > You probably need to nest your model and rotate it accordingly then.
     
  3. ivanmdeb

    ivanmdeb

    Joined:
    May 3, 2019
    Posts:
    3
    Hi, I purchased the engine yesterday. I'm experimenting with the demos included. I made a copy of the Mountains scene and removed the included platforms. I then created my own Tilemap (include tileset and palette). I added a Tilemap Collider 2D and Composite Collider 2D to it and set the body type to static. I changed the sorting layer of the Tilemap Renderer to Platforms. I also checked to make sure the the Platforms layer is used in the CorgiController. And it is.

    However, the problem is that the character ignores the tilemap and falls through. What am I missing?
     
  4. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @ivanmdeb > Hard to tell without more info. The problem could be on your character's side, or on the level's side. I'd suggest comparing both against the ones in the demo scenes, and reading the documentation, it explains everything. If the problem persists please use the support contact form and provide a bit more info on what you tested and the results of these tests.
     
  5. ivanmdeb

    ivanmdeb

    Joined:
    May 3, 2019
    Posts:
    3
    I just copied the Mountains scene, added a Tilemap and changed the Sorting Layer to Platforms and Body Type to Static. That's all. The rest of the scene is that of the original demo scene.
     

    Attached Files:

    • c1.png
      c1.png
      File size:
      922.1 KB
      Views:
      169
  6. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @ivanmdeb > The sorting layer has zero impact on collisions.
    As I said, have you read the documentation? Have you tried comparing with the other scenes? There are many examples of tiled based levels (all the Retro ones). I can't tell you what's wrong without more info. Once again, please use the support contact form if the problem persists, thanks.

    Edit : it looks like you didn't set the layer though, that may be this. But again, without more info, it's just a wild guess. If you follow the documentation and compare, that should work :)
     
  7. ivanmdeb

    ivanmdeb

    Joined:
    May 3, 2019
    Posts:
    3
    You're right. I didn't set the layer. It works fine .) Great job with the engine!
     
    reuno likes this.
  8. krisss666

    krisss666

    Joined:
    Feb 14, 2014
    Posts:
    18
    i'm testing around the retro adventure demo to understand how variables are saved in the engine:
    Currently only the lives are saved and loaded and not the HP from the health script.

    So I'd like to add the HP as well: the player won't respawn at each hit: he will respawn only when he lost all it's HP and then lost 1 life : i already change the gamemanager and UI but i dont find how i can add thoses new variables to be saved and loaded like MaximumLife and CurrentLife: i just find the " MMGameEvent.Trigger("Save");" in the loading scene but nothing else.

    If someone already made this or a save for the health script , thanks by advance for your advice.

    Ps: i know i can use playerpref to do that, but i'm thinking using corgi logic/script should be better
     
  9. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @krisss666 > I'd suggest reading the SaveLoadManager's documentation. It's quite simple, all explained, and the class is fully commented.
     
    Quinn221 likes this.
  10. javi_unity402

    javi_unity402

    Joined:
    Nov 29, 2018
    Posts:
    10
    Hi @reuno.

    Congrats for amazing work.

    My question, Is there an easy way to disable weapon (or hide sprite) when character is dead? I was trying through weapon animations but none of them are false when character condition is dead.

    Thank you!



    Corgi Engine worth every $ spent on it :)
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @javi_unity402 > There is nothing built-in for this, you'd need an external class (or extend the Weapon class) to handle that. I'll add that to the todo list though, passing that info as an animation parameter seems like the most elegant way of doing it.
     
  12. javi_unity402

    javi_unity402

    Joined:
    Nov 29, 2018
    Posts:
    10
  13. krisss666

    krisss666

    Joined:
    Feb 14, 2014
    Posts:
    18
    Thanks Reuno but I was searching for an exemple script and i just found the retroadventureprogressManager: it should be ok now. The doc isn't so easy to understand without practical exemple, must depend to programming's level :)
     
  14. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @krisss666 > You can right click on any class in your IDE and look for references of it in use. That's usually the best way (or at least the one I prefer) to understand how a class works :) Glad you figured this one out!
     
  15. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,788
    Hey @reuno , I recently had trouble getting my melee attack to work reliably. I think it had more to do with my animator controller, rather then the Corgi Engine, but it occurred to me that it would be very useful if the melee weapon component had a "debug" check box that, when checked, would draw a visualization of the hit box when it's active. Then you could see exactly the size and shape of the hit box, but also the exact moments when it is active or not. That way, you could fine-tune your animations and your melee attack parameters so that they match.
     
    Boom_Shaka likes this.
  16. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @kdgalla > That is already built-in and you should see the gizmo if you select the weapon's damage area.
    You can also look at the damage area's collider, it's pretty much the same thing.
     
  17. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,788
    Hmm. I'll look again when I get a chance.
     
  18. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    Hi thanks for this great asset. I'm trying to make a melee weapon but I have problems with a delay between button press and animation play - although it shouldn't be delayed (animator setup) and sometimes the animation doesn't even play when I change direction and attack.
     
    Last edited: May 6, 2019
  19. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @RolandoPT > This is likely due to your animator's setup (hard to tell without any context, but that's likely the cause). If your animation gets delayed, that's probably because another transition is preventing it from running. Same thing if it doesn't play. Make sure your animator can switch to your attack animation at any time. Don't hesitate to read Unity's documentation about it (there's nothing specific to the engine in that regard, it's just standard Unity). It's usually about exit times and general animator setup.
     
  20. HCrowley

    HCrowley

    Joined:
    Oct 16, 2013
    Posts:
    18
    @RolandoPT i had exactly the same problem with my first project using the Corgi Platform Engine, trying to get attack animations to reliably trigger (see top of previous page for details). as @reuno says, it usually boils down to the Animator setup, it certainly did in my own case

    it took a fair bit of faffing about, but i eventually got both melee and ranged weapons to trigger reliably (for both Players and NPCs) by a) making the Animator Controllers as simple as possible (basically similar to the ones used in most of the demos), rather than overcomplicating them. and b) by completely ignoring Unity's suggestions for Transition Settings

    impossible to say what would work for your own use case, but all i can say is that it IS possible to get things working. it just takes a fair bit of experimentation with the Transition Settings values
     
    reuno likes this.
  21. krisss666

    krisss666

    Joined:
    Feb 14, 2014
    Posts:
    18
    @RolandoPT
    when i want to work on animatior , i usually setup the animator windows like the image and select the target gameobject, so i can see wich animation is trigger and the triggers's status (this picture isn't mine, it's just for explanation)
    You need to check the exit time in each transition because by default, unity quit an animation only when it's finish :maybe your melee attack start when your move animation is finished, so you need to uncheck the "has exit time".
    See this link for more explanation : https://docs.unity3d.com/Manual/class-Transition.html
     
    reuno likes this.
  22. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    hello, I need advice on how to place an object that falls on another object that is still on the ground. For example: I have two objects on the Pushables layer. One is on the ground and the other I start from above so that it falls. When it falls and ends up on top of the other object Pushables can't lean but it goes through it. I set the two layers on the Corgi Controller of the two objects but if I put the Platforms and Pushables layers on the PlatformMask the falling object also crosses the Platforms layer falling down to infinity. Something different when I drop it over the head of the Player. The falling object pushes the player under the Platform layer making it fall to infinity. How can I solve it?
     
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @gabry90 > I already answered the message you sent me, no need to post it everywhere :)
     
  24. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    I think I found the problem. It seems if the layer of the object is also one of those set in its corgi controller in the various masks for collisions the object does not move anymore, not even gravity works. If, on the other hand, I change the layer in any one that is not present in the various collision masks, it works but it cannot collide with objects that share its own layer, which leads to the problem I ask before: it is not possible to make two objects interact with the physics of Corgi if they are on the same layer?
     
  25. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @gabry90 > Pushables (at least the latest implementation, the raycast based ones) really aren't physics based. They're meant for simple puzzles stuff, pushing something left to right, that kind of things. If you start stacking them, that's likely not gonna work. Instead I'd recommend either switching to a physics based solution for "complex" interactions (think Angry Birds), or if it's relatively lightweight you can try the "old" implementation, which is a sort of interface between the engine's system and Unity physics.
     
  26. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    the problem is not with pushable, the problem occurs with any object in any layer that you want to stack, the strange thing and that would work if the object could be moved, but it seems that when raycasting hits your collider it stops. Wouldn't it be enough to ignore the collisions if the object is the same from which the raycasting starts and if the collision happens on the same layer?
     
  27. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    I'll give you an example on which you can try what I say. Create an object in the scene, assign it any layer, then add the Corgi Controller and in the PlatformMask, in addition to setting the layer for the terrain, you also add the layer in which the script is attached. You will see that the object will not move. The fact is that already as set up all other objects should collide and then stop because it already works like this. The problem is that not being able to move it simply remains a fixed platform, if raycasting does not block the movement on itself in my opinion it could work without making other additions
     
  28. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    I'll try now on empty project:

    GameObject with layer: Pushables
    In the gameObject i add CorgiController with PlatformMask = Platforms + Pushables

    When I play the scene the object falls through the Platform layer where I set the terrain.
    Analyzing the debug a little I found this:

    -CorgiController, line 854:

    float distance = MMMaths.DistanceBetweenPointAndLine (_belowHitsStorage [smallestDistanceIndex] .point, _verticalRayCastFromLeft, _verticalRayCastToRight);

    distance is always 0 because the beam is touching against the box collider of the same object! If this were solved, or ignore the ray casting on itself, the problem would be solved, I think :)
     
  29. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    148
    Hi,could the scene objs like pushable objects be simulated by corgi engine, I mean ,not by Unity API (like rigidbody.. etc, cause sometime it is not very suitable), I knew now pushing is simulated by rigidbody,and I am very curious that weather it could be simulated by corgi engine,just like Character does, thanks very much
     
  30. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    maybe I understand where the problem is.

    I did various tests, testing the gravity of an object with the same layer set in the platform mask. Basically this happens: raycasting takes place inside the collider, being the collider of the same layer on which raycasting shoots the ray raycasting ALWAYS returns the object, or itself. To overcome this problem I found various solutions, the simplest but also the least elegant is that of disabling the collider when the raycasting is fired on the same layer of the object and re-enabled later after the due calculations. Obviously this solution is not performing as this procedure is done at every frame.

    Another solution that I tried to do is to ignore the calculations when the resulting raycasting is hitting the same object.

    Below I tried a fix on Corgi Controller on a piece of the code: https://pastebin.com/XtVasr5z

    Obviously it doesn't work since the problem is that the raycast ALWAYS returns the first collider it touches, and therefore ALWAYS the collider of the same object, to overcome this problem we should use RaycastAll instead of the simple Raycast to process all the points of contact and not just the first Raycasthit2D it returns.

    so, basically, need replace MMDebug.RayCast with Pysics2D.RaycastAll(...) and change some logic
     
  31. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    102
    Have you tried defining your own class and give it a dedicated layer? That way you can tell it exactly what to do when it comes into contact with any other layer (or player).
     
  32. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    exactly. With any layer other than the one set on the Corgi Controller Platform, it works. The problem occurs when you have to manage two objects on the same layer with both the layer set in the PlatformMask. as I discovered before, raycasting on the same object must be managed, but this has not been done at the moment, which if solved could implicitly add the mechanics of colliding two or more objects on the same layer, which would mean: objects that they can be impaled like "tower effect"
     
  33. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    anyway, i found the solution, need fix Corgi Controller, @reuno i send you the code :)
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @gabry90 > Please let's keep the discussion to the email thread, it's just easier that way.
     
  35. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    It's definitely a unity transition issue. Melee attacks have to be fast so I ended up writing my own MeleeAttackAbility and playing the attack animations directly through animator.play(). No more transition issues.
     
  36. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    Thanks for the help.
    I fixed the problem with the animation not playing, but I couldn't get rid of the delay after pressing attack. So I wrote a new MeleeAttackAbility with combo support and instant animation play.
     
    reuno likes this.
  37. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @RolandoPT > Triggering animations through animator.play() is also a surefire way to do things :)
    The reason I didn't do it this way is that going through the animator gives much more freedom to animators to do more complex stuff, enables blending and things like that, and you can get the same result - assuming you have enough patience for the admittedly very not user friendly way transitions are implemented :)
     
  38. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    Hi @reuno and thanks for the feedback.
    I know using the animator gives more freedom, that's why I've implemented a bool so the animator always knows when an attack animation is playing.
     
    reuno likes this.
  39. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    148
    Had I made myself clear? Sometimes I really worry about it,cause my wirtten English is somekind of poor...
     
  40. gregacuna

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    49
    Purchased Corgi several months ago and happy to finally getting to know it and be working on a new platformer. It's extremely cool...thanks!

    This may seem like a strange question...

    We want to have the health meter work backwards on the "enemy" characters so that it starts empty and gets health added to it every time the AI character is hit. Can this be done?
     
  41. gregacuna

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    49
    Purchased Corgi several months ago and happy to finally getting to know it and be working on a new platformer. It's extremely cool...thanks!

    This may seem like a strange question...

    We want to have the health meter work backwards on the "enemy" characters so that it starts empty and gets health added to it every time the AI character is hit. Can this be done?
     
  42. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @Bagazi > Pushables already use a Corgi Controller, that's already the case. You can still have rigidbody ones if you want.
    @gregacuna > Of course it can be done. You'll need to either extend the progress bar script to reverse the way it's filled, or simply modify your progress bar prefab to invert the scale of it (or change its anchor points).
     
  43. gregacuna

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    49
    @reuno
    @gregacuna > Of course it can be done. You'll need to either extend the progress bar script to reverse the way it's filled, or simply modify your progress bar prefab to invert the scale of it (or change its anchor points).[/QUOTE]

    Thanks! Great support. Gives us even more confidence to be using Corgi for the new game. Cheers.
     
    reuno likes this.
  44. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    9
    there is a method for stop immediatly movement of player character? I tried both:

    _characterHorizontalMovement.SetHorizontalMove(0);
    _controller.SetHorizontalForce(0);

    but the animation of run still remain, need force change corgi movement state to Walk?
     
  45. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @gabry90 > Yes, you'll need to change the state as well.
    And once again, please stick to email for support questions, thanks.
     
  46. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    148

    Thanks very much, and what is the scene name which include "pushable" demo?:)
     
  47. Amvient

    Amvient

    Joined:
    Feb 5, 2016
    Posts:
    22
    Hi

    I got this asset a long time ago, but only till now I have time to start using it.

    It is fantastic, and will provide a great review for such amazig work.

    One quick question, or maybe request. Do you know if it is possible to collect characters during the level and change them live to use different abilities? (Maybe a character swap or rotation while the they are displayed on the scene)
     
  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    3,112
    @Bagazi > It's the aptly named RetroPush demo scene :)
    @Amvient > There are CharacterSwap and CharacterSwitch abilities (either you just swap visuals, or entire Character prefabs). It's all explained in the documentation, and there are Minimal demo scenes for each. The collection part would have to be implemented, but there are already classes for that, so you just have to merge both features.
     
  49. Amvient

    Amvient

    Joined:
    Feb 5, 2016
    Posts:
    22
    Thanks for the update. I will check it out.
     
  50. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    Hi to all.
    Is there a buildin possibility to respawn a box on destroy?