Search Unity

[RELEASED] Corgi Engine - Complete 2D/2.5D Platformer [new v8.0 : advanced damage system]

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

  1. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,631
    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.
  2. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @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.
     
  3. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,631
    Hmm. I'll look again when I get a chance.
     
  4. 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
  5. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @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.
     
  6. HCrowley

    HCrowley

    Joined:
    Oct 16, 2013
    Posts:
    41
    @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.
  7. krisss666

    krisss666

    Joined:
    Feb 14, 2014
    Posts:
    21
    @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.
  8. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    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?
     
  9. reuno

    reuno

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

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    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?
     
  11. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @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.
     
  12. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    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?
     
  13. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    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
     
  14. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    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 :)
     
  15. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    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
     
  16. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    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
     
  17. Boom_Shaka

    Boom_Shaka

    Joined:
    Aug 31, 2017
    Posts:
    141
    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).
     
  18. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    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"
     
  19. gabry90

    gabry90

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

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @gabry90 > Please let's keep the discussion to the email thread, it's just easier that way.
     
  21. 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.
     
  22. 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.
  23. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @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 :)
     
  24. 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.
  25. Bagazi

    Bagazi

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

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    59
    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?
     
  27. gregacuna

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    59
    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?
     
  28. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @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).
     
  29. gregacuna

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    59
    @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.
  30. gabry90

    gabry90

    Joined:
    Dec 16, 2015
    Posts:
    29
    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?
     
  31. reuno

    reuno

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

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611

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

    Amvient

    Joined:
    Feb 5, 2016
    Posts:
    24
    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)
     
  34. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @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.
     
  35. Amvient

    Amvient

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

    RolandoPT

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

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @RolandoPT > When you say a box do you mean a box collider, or just any gameobject?
    And respawn how, and where? Not sure I understand the use case here.
     
  38. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    I have a pushable object and I want it to respawn after its dead/destroyed.

    https://giphy.com/gifs/dVzI8ayg6Zt80emebN
     
  39. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @RolandoPT > You can probably use the AutoRespawn component for that.
     
  40. Miketysonjr

    Miketysonjr

    Joined:
    Mar 15, 2018
    Posts:
    23
    hi , i did try to replace sword to gun on an sample scene , its slash but there is no damage or collision to the enemy ...
    I did carefully check layer named ,tags, add box or edge collide , rigidbody , set the damage and knockback force..... but seem the edge never touch enemy , instead in go through sprite... i have no ideals how to fix ...
     
  41. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @Miketysonjr > It's hard to guess what you setup wrong without any context. I'd suggest following the documentation on how to create weapons, and maybe comparing with other scenes and demo characters. If the problem persists, please use the support form I'll be happy to help.
     
  42. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    The autorespawn only works on player death and not when the object itself is destroyed. I can write this myself, I just wanted to now if there is a build in method that I'm not finding.

    I thought AutoRespawnDuration would do what I want. but nothing happens.
     
    Last edited: May 9, 2019
  43. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    32
    I just tested this and mine works fine. I placed 1 for the Auto Respawn Duration and my object respawns a second after it is destroyed.

    Screen Shot 2019-05-09 at 8.26.01 AM.png
     
    reuno likes this.
  44. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    Hi,I am wondering whether it is possible to use Corgi Engine in multiple-Players games,which will refer to network Synchronization for separated players.
     
  45. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    Hi @kriyordev thanks for the screen.
    What are your health settings?
     
  46. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @RolandoPT > No, it doesn't only work on player death. It does exactly what you're after, I believe. Make sure you don't destroy your object on death though.
    @Bagazi > Sure, it's possible. It's definitely not the easiest task if you're new to programming, but it's been done before.
     
  47. RolandoPT

    RolandoPT

    Joined:
    Jul 31, 2013
    Posts:
    15
    @reuno If I don't destroy on death the box doesn't even get disabled and stays there.
    i don't know why it isn't working.
     

    Attached Files:

  48. reuno

    reuno

    Joined:
    Sep 22, 2014
    Posts:
    4,923
    @RolandoPT > What exactly doesn't get disabled? What's your object's death animation like?
    If you have more questions about this, please use the support form, I'll need more info, thanks.
     
  49. KriYorDev

    KriYorDev

    Joined:
    Oct 3, 2017
    Posts:
    32
    I don't have a Health script attached to any Falling Platform.
    I just have a GameObject with the FallingPlatform script and the Auto Respawn script. That's all. The rest is playing with the editor numbers.
     
  50. gregacuna

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    59
    3DCamera in Corgi3D scene and on the 3DCamera prefab has two missing scripts at the bottom. Seems that one is supposed to be the Parallax Camera script which I was able to find, but the other should be for Post Processing, but not finding that script at all and the PostProssingProfiles are also missing the scripts. How do I fix this.
     

    Attached Files: