Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

[RELEASED] Rex Engine: A Unity 2D Platformer Engine

Discussion in 'Assets and Asset Store' started by BeeZee, Jun 20, 2017.

  1. HCrowley

    HCrowley

    Joined:
    Oct 16, 2013
    Posts:
    41
    Hiya @BeeZee this may be a known thing, but vertically moving platforms don't rebound from ceillings/floors when "Turn on Wall Contact" is checked, they just hit an obstacle and stop. I guess technically speaking, floors and ceilings aren't walls, and I guess it's also possible to use Waypoints instead, but I kinda expected that vertical platforms would operate the same way as horizontal platforms

    Anyhoo, I've hacked my version of MovingPlatforms.cs to set willTurn true if DidHitCeilingThisFrame() or DidLandThisFrame(), so my vertical platforms now work the way I want them to, but you may want to lhave a look at it in case anyone else hollers...
     
    BeeZee likes this.
  2. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Thanks for letting me know! Total oversight on my part. I'll add that to the list!
     
  3. jeremyfryc

    jeremyfryc

    Joined:
    Mar 11, 2014
    Posts:
    95
    Hello everyone,

    Has anyone encountered a bug with LedgeGrab? I have two players (two different characters) that I have set up with no issues. They LedgeGrab perfectly. But I just created my third player and the LedgeGrab is spotty. Not only that, if the player crouches or enters water (both affect box colliders), then the LedgeGrab doesn't even work. It's as if the colliders are not responding to the edges of the terrain.

    Check it out here (gifs and screenshots): https://imgur.com/a/ruzYd1C

    In the gifs at the link above, you can see that the guy with goggles (Dexter), his ledge grab is fine. He goes in and out of the water. No issues. He can ledge grab before and after. The other guy with the sombrero (Jedo), his ledge grab works at first, but then he goes into the water and then it stops working.

    In the screenshots, you can also see that Dexter's box collider's are exactly the same. Jedo's, on the other hand, are slightly different. In order to get the ledge grab working at all, I have to make the box collider slightly bigger on the controller. If they are the same size, ledge grab doesn't work. And yes -- both of these characters have the exact same boxes and everything toggled in their controllers. Only difference, sprite size and collider size.

    I've tried everything I can think of. I first just copied and pasted my previous player prefab and inserted new animations, adjusted the colliders to match the size. Once it was giving me the above problems, I created a new player from the Rex Palette and set up the player that way. Same issue. I have also set up a new player from scratch, creating each and every component and making sure everything is exactly as my other players are. Same issue.

    The two players I created before work marvelously, but this one doesn't. Any ideas? Is this a bug? If not, what could I possibly be doing wrong?

    In fact, how do colliders work with the ledge grab? What's it that is telling the player prefab to stop at the ledge?

    I appreciate any responses. Thanks!

    EDIT: I added one more gif to the imgur upload. I noticed that the box collider on the controller actually changes size somehow after the player enters the water. Like I mentioned above, I needed the collider to be bigger in order to get the player to ledge grab (not on my other players' colliders though. Their colliders are the same size yet ledge grab works.). So, when the player exits the water, the box collider on the controller decreases in both width and height. Strange o_O
     
    Last edited: May 6, 2020
  4. NamraGame

    NamraGame

    Joined:
    Feb 17, 2019
    Posts:
    31
    Thank you @Bagnol for the reply! Yeah it looks like the RP isn't compatible with bunch of stuff yet.

    Few questions:
    1. Is there a way the make the character stop playing the walk animation when it encounters a wall?
    2. a way to have another turn animation when the character is walking/running?
    3. to play an animation when we start to walk?

    many thanks!
     
  5. Tom_Bombadil_

    Tom_Bombadil_

    Joined:
    Aug 6, 2018
    Posts:
    46
    So a feature that I really wanted was a quick and easy way to change what layers an individual object collides with through the inspector. So I wrote a quick augment to the RexPhysics script that adds a layer mask variable to the rexphysics that allows you to select the collision layers. There is one for both the one way layers and the solid layers. A couple of notes on this: The code is specifically told to ignore the Pushable and Boundries layers as collision for those is handled else where so selecting or deselecting those does nothing, unselecting the Terrain layer will automatically turn the willIgnoreTerrain variable to true, because of the way the drop from one way system is coded you can not drop from one ways that you add only the default PassThrough layer.

    Now onto the actual code. The first step is to create a script named LayerMaskExtensions.cs and place it in your project with the following code it it. This was a static function I have to add extra functionality to layer masks.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3.  
    4. public static class LayerMaskExtensions
    5. {
    6.     public static string[] MaskToNames(this LayerMask original)
    7.     {
    8.         var output = new List<string>();
    9.  
    10.         for (int i = 0; i < 32; ++i)
    11.         {
    12.             int shifted = 1 << i;
    13.             if ((original & shifted) == shifted)
    14.             {
    15.                 string layerName = LayerMask.LayerToName(i);
    16.                 if (!string.IsNullOrEmpty(layerName))
    17.                 {
    18.                     output.Add(layerName);
    19.                 }
    20.             }
    21.         }
    22.         return output.ToArray();
    23.     }
    24. }

    Then what you need to do is add the following public method to anywhere within the public methods region of the RexPhysics Script.

    Code (CSharp):
    1.         public void DefaultCollision()
    2.         {
    3.             terrain = LayerMaskExtensions.MaskToNames(terrainLayers);
    4.             oneWays = LayerMaskExtensions.MaskToNames(oneWayLayers);
    5.             foreach (string element in terrain)
    6.             {
    7.                 if(element != "Pushable" && element != "Boundaries")
    8.                 {
    9.                     AddToCollisions(element);
    10.                 }
    11.             }
    12.             foreach(string element in oneWays)
    13.             {
    14.                 if (element != "Pushable" && element != "Boundaries")
    15.                 {
    16.                     AddToDownCollisions(element);
    17.                 }
    18.             }
    19.             if(Array.Exists(terrain, element => element == "Terrain") == false)
    20.             {
    21.                 willIgnoreTerrain = true;
    22.             }
    23.             if (Array.Exists(oneWays, element => element == "PassThroughBottom") == false)
    24.             {
    25.                 RemoveFromDownCollisions("PassThroughBottom");
    26.             }
    27.         }
    and finally you need to call that method from the top of your start function and declare the following variables in the general variable declaration section of RexPhysics. The pre-declaired values determine which layers are selected by default. You could change this but these are the ones the engine uses.

    Code (CSharp):
    1.         public LayerMask terrainLayers = 256;
    2.         string[] terrain;
    3.         public LayerMask oneWayLayers = 512;
    4.         string[] oneWays;
    It may not help that many people but it is something that I have found myself using and thought I would share it. I have not really dug into how collisions work as this merely using the public methods from the documentation for the engine but it is an easy way to quickly assign no collision layers from the editor.
     
    realitywhoneedsit and BeeZee like this.
  6. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    Sorry for the super late reply, was focusing on animating.

    So, I'm not sure what I did, but I kinda got half of this working. Currently, I have a Follow Target movement that's set to Wait, and a Jump sequence and a Follow sequence. The Jump sequence has a Wait action randomized between 1 and 3 seconds followed by a Jump action. The Follow sequence has a Change Movement action with the Follow Target movement slotted and Change Type set to Start New. Finally, I have a Physics event that tells the Follow sequence to stop when it collides with the floor.
    With this, it ends up not moving left or right at all, but I can get it to jump.
     
  7. daddyshome

    daddyshome

    Joined:
    Oct 26, 2019
    Posts:
    5
  8. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    The player will be moved onto the position of the checkpoint itself when they spawn. I'd recommend moving the checkpoint up a little bit, and that should solve it. From there, you can change the sizes and/or offsets of the sprite and collider in the checkpoint prefab to make it fit your project.
     
    daddyshome likes this.
  9. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    I think all of those will require a bit of code. I'd look at RexActor.cs for #1, RexController.cs for #2, and MovingState.cs for #3.

    For #1, I'd override this function:

    Code (CSharp):
    1. public virtual void OnPhysicsCollision(Collider2D col, Side side, CollisionType type)
    That gets called automatically when you run into terrain. The "side" argument that gets passed in will tell you if the collision was on Side.Right or Side.Left, which you can use to determine if you hit a wall.

    For #2, RexController.cs is determining the turning animation to play starting on line 737.

    #3 will probably be the most complicated. There's a similar thing set up with jumping, where the jump begins with a starting animation, then segues into a looping body animation. I set it up via a coroutine, so when a jump begins, the coroutine gets called and plays the starting animation, waits for the duration of that animation, and then plays the looping body animation.
     
  10. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Your sprites are looking awesome!

    It sounds like maybe there's something happening with the raycasts that detect ledges. I haven't seen that on my end, but certain collider sizes might make it act up.

    RaycastHelper.cs is where the ledge detection happens, primarily in the DetectLedgeOnWall() function on line 118. If you pop open a Scene View window during gameplay, you should see some red raycast lines coming off of your player when they're jumping against a wall; those are the ledge detection raycasts. The quick explanation is, the raycasts come downward, starting above and slightly to the side of your player. They're looking to see if they encounter a floor that's flush with the top of your player's collider. If so, they treat that as a ledge, and initiate the ledge grab.

    I might try changing some of the values in that function to see if they make a difference. Specifically, I think lines 123, 127, and 130 deal with the sizing and spacing of the raycasts. You might also want to experiment with the "offset" value getting passed into that function. It's 0.25 by default, and is used to change the overall length of the raycast on line 123.

    EDIT: For your changing BoxCollider sizes, are you using the Booster.cs script for your player? He's got some things on him that are hard-coded to change the size of his collider, just for the demo. If so, I'd recommend removing that script and replacing it with either RexActor.cs or your own script that extends RexActor.cs.
     
    jeremyfryc likes this.
  11. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Is your physics event that stops the Follow sequence active at the start of the scene? It might be activating immediately, which would stop the Follow before it even begins. If so, I'd start off with that event disabled, and activate it as part of your Jump sequence (specifically, after the enemy has already left the ground, so it doesn't trigger too soon!)
     
  12. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    Okay, so the physics event was checked on the AI Routine, so I unchecked it and added a Toggle event to enable it, but I'm unfortunately still getting the same result. I went ahead and attached a screenshot of the Jump Sequence I have right now. Also, I don't know if it's doing something, but I currently don't have anything slotted for a starting movement and slotting in the follow target movement doesn't seem to do anything either. jumpai.png
     
  13. Tom_Bombadil_

    Tom_Bombadil_

    Joined:
    Aug 6, 2018
    Posts:
    46
    So I was working on some features for my project and I was wondering if there was a way to from the Rex actor script to call and play a single animation. Overriding whatever animation is playing from the state at the time then once the animation completes go back to the default? This is for cutscene type events as well as having animations for interacting with buttons and levels and such which are not handled by a state.
     
  14. jeremyfryc

    jeremyfryc

    Joined:
    Mar 11, 2014
    Posts:
    95
    Thank you for the encouragement! I'm new to pixel art and it's definitely a WIP.

    And your response is much appreciated. I'll do some tinkering with it and see if I can get it to work. I'm sure there's something going on locally in my project. With the instructions you provided, I'm sure I can figure it out.

    And the box collider thing -- yeah, I'm using RexActor.cs scripts. The booster script is definitely tailored to that character and isn't ideal for a new project like you said. So, it's weird about the box colliders. After I fiddle with it, I'll post something here if I continue to encounter an issue. But again, your response is timely and appreciated! (Really cool how you designed how the ledge detection works. Rex Engine is so awesome!)
     
    BeeZee likes this.
  15. NamraGame

    NamraGame

    Joined:
    Feb 17, 2019
    Posts:
    31
    @BeeZee thanks!
    I tried to tackle the "turn run animation" think because I think it adds a lot. Playing at Dragon's Trap remake made me realize how cool it is to see the character "sliding" when turning.


    Here is my take on it:

    Like Beezee said, I opened RexController.cs and created a public animation:
    Code (CSharp):
    1. public AnimationClip turnwalkAnimation;
    then, line 736, in the coroutine I put that:
    Code (CSharp):
    1. if (slots.physicsObject.IsOnSurface() && (slots.physicsObject.properties.velocity.x >= 0.5f || slots.physicsObject.properties.velocity.x <= -0.5f))
    2.             {
    3.                 animation = turnAnimations.turnwalkAnimation;
    4.             }
    do you think it's a good way to do it?
    for now, works fine for me, so I'm happy :)
     
    jeremyfryc and BeeZee like this.
  16. obscured76

    obscured76

    Joined:
    Jun 9, 2015
    Posts:
    5
    I add a melee attack to rexactor, but its slot only accept boxcollider2d as collider.
    Is there any way to use another 2d colliders (like polygon collider or circle) with melee attack?
     
  17. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Looks like a solid method to me! Also, man, looking at that gif, I totally need to play Dragon's Trap. That looks so slick.
     
    jeremyfryc likes this.
  18. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Unfortunately not. The attack itself could potentially be reconfigured to use other types of colliders, but there's a lot of other math under the hood for things like determining hit sparks that requires it to be a BoxCollider2D.
     
  19. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    RexController.cs has a function called "PlaySingleAnimation" that should be exactly what you're looking for. You can pass it an AnimationClip and it will play through that clip exactly once, overriding any other animations your character is currently doing. There's also a "PlayLoopingAnimation" function that behaves the same way, but will loop the animation indefinitely until you manually stop it via "StopLoopingAnimation".
     
  20. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    This should work:




     
    PhantomFox128 likes this.
  21. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    Thank you so much!!! It's working perfectly now!

    EDIT: Almost working perfectly. The AI is working great now, but I still can't get the enemy's jump animation to play, even though it's all set up as far as I can tell.

    EDIT2: Ran into another small issue. When the player jumps over the enemy as the enemy is jumping, the enemy is able to turn around mid-jump. How would I prevent that? Checking the freeze horizontal movement box full on stops the enemy from moving at all and I can't find another option for it.
     
    Last edited: May 20, 2020
    BeeZee likes this.
  22. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    The animation should work -- these are my jump settings:



    I'd double-check that your jump animation is part of the same Animator controller as the other animations on the character, etc.; as long as that's set up right, and the animations are slotted, I don't think there's anything in Rex that should stop a jump animation from playing.

    I looked into the freeze horizontal movement thing, and it looks like you're right -- the enemy AI doesn't play nicely with freeze horizontal movement. I think for the time being, that unfortunately might just have to be an AI limitation.
     
    PhantomFox128 likes this.
  23. NamraGame

    NamraGame

    Joined:
    Feb 17, 2019
    Posts:
    31
    It indeed looks slick! Wonder boy3 was a great game at the time and the remake makes you realize how good it is, still!

    I was wondering, are you planning to make a tutorial for the pause menu? In case we wanna add some functionalities (exit, start menu etc.) thanks!

    -- also, have you noticed ground pound on a spring makes strange result?
     
    Last edited: May 21, 2020
  24. obscured76

    obscured76

    Joined:
    Jun 9, 2015
    Posts:
    5
    Ok. thank you for replying.
     
    Last edited: May 26, 2020
  25. vizard00

    vizard00

    Joined:
    Feb 10, 2017
    Posts:
    13
    Thanks , its there and i didn't saw it . o_O
     
  26. PhantomFox128

    PhantomFox128

    Joined:
    May 22, 2019
    Posts:
    157
    So, I don't know what it was, but I originally had a jump animations slotted for both the Animation and Jump Body. Removing the Jump Body seems to have fixed it, though I don't know why.
    The only thing I'm getting now is there's a bit of a delay before the jump animation plays. It'll play, but only at about the halfway point of going up. My player doesn't have this issue, so I don't know what's going on with it. My enemy can only jump about half the height my player can, but I don't know if that matters.
     
    Last edited: Jun 2, 2020
  27. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    Hello everyone, Could someone help me. I am trying to make a player with autorun that turns on wall collision. I have no idea if there is a built in option. Thanks.
     
  28. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    Hey guys do somebody have voucher code for this product?
     
  29. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    This should work, if you put it in your player's RexActor script (or their Booster script, if you're using that one, or whatever custom script you've made for your Player that extends RexActor):

    Code (CSharp):
    1. public override void OnPhysicsCollision(Collider2D col, Side side, CollisionType type)
    2.     {
    3.         if(side == Side.Left || side == Side.Right)
    4.         {
    5.             slots.controller.GetComponent<MovingState>().autorun = (slots.controller.direction.horizontal == Direction.Horizontal.Left) ? Direction.Horizontal.Right : Direction.Horizontal.Left;
    6.         }
    7.     }
     
    Joe-Mar likes this.
  30. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    It works, thank you. Now I need to overwrite a way to not turn when jumping and touching the wall but instead wall cling. I am thinking about how to do it.

    Thank you BeeZee.
     
  31. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    Ok, I tried something but it work just half of the time. The other half it bounces off the wall. HELP.
     
  32. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    You can check if the actor is on a surface (i.e. is grounded) with this:
    Code (CSharp):
    1.             if(slots.physicsObject.IsOnSurface())
    2.  
     
    Joe-Mar likes this.
  33. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    It kind of worked, I still have to implement a double jump in the direction opposite to the wall.

    Here is what I want to do:
     
  34. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    I tried this and it works when you are falling from jump. BUT if you touch the wall on jump in the up direction it will ignore it and change direction.

    public override void OnPhysicsCollision(Collider2D col, Side side, CollisionType type)
    {
    if (side == Side.Left || side == Side.Right)
    {
    if (slots.physicsObject.IsOnSurface())
    {
    slots.controller.GetComponent<MovingState>().autorun = (slots.controller.direction.horizontal == Direction.Horizontal.Left) ? Direction.Horizontal.Right : Direction.Horizontal.Left;
    }
    else if(slots.physicsObject.IsAgainstEitherWall())
    {
    slots.controller.GetComponent<MovingState>().autorun = (slots.controller.direction.horizontal == Direction.Horizontal.Left) ? Direction.Horizontal.Right : Direction.Horizontal.Left;
    }
    }
    }
     
  35. NamraGame

    NamraGame

    Joined:
    Feb 17, 2019
    Posts:
    31
    Quick questions about sound:
    • do we know where to change the death sound?
    • have you noticed the audios slotted in the controllers cant play at the same time? like, for instance, a "footstep sound" will cancel a shooting sound.
     
  36. NamraGame

    NamraGame

    Joined:
    Feb 17, 2019
    Posts:
    31
    looks like you just missed the spring sales ;)
    I actually bought Rex engine like 2 weeks before the sales so :oops: but then I consider it's worth it so...
     
  37. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    Hi guys. I can't choose between the corgi and rex engine. Which engine is better? I downloaded the pirate version of a corgi engine and it looks not really good (I mean components code) and it's hard to investigate because it even doesn't have comments inside the components code. Does the Rex engine has the same situation or Rex code wrote better than Corgi code? Thanks for the answers
     
  38. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    yeah, I think so. 60$ is not too much but only in case when you absolutely sure that you will buy a product which is 100% fit you
     
  39. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    The code is commented, it has great support, tutorials and big potential for making your ideas a reality. Been using it for almost 2 months and I can´t get enough of it. IT IS A MUST.
     
    jeremyfryc likes this.
  40. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    Thanks. You earned them 60$)))
     
    jeremyfryc and Joe-Mar like this.
  41. NamraGame

    NamraGame

    Joined:
    Feb 17, 2019
    Posts:
    31
    I actually bought both. The features are similar but the philosophy is different, I would say the progression curve is slower with Corgi ( for some reason, Rex engine organisation seems more logical to me). Tutorial videos are longer and less explicit I find. Is it because there's slightly less people on the forum, but I prefer here.

    It looks like you already bought it, but in case other people read it:
    at first, I wanted Corgi for the cinemachine camera implementation but I found the results are wonky. I like how Rex camera is reacting, and I finally ended up choosing procamera2d (which is not integrated out of the box with corgi).
    Then, to be perfectly fair, I think Corgi have slightly more options, but it looks like Beezee is helping us implementing those and there's regular updates, so, let's see. Also, most of the time, with a little bit of imagination, you can do it, like, let's take the jetpack for instance; a custom flutter jump (without code) and particles attached to it and we're done.

    Corgi's strength I think is to play with all these little details (screen shake, effects, particles etc.) to make it attractive, that could be an explanation why it's a bit more popular.
     
  42. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    Yeah, I also got the ProCamera2D and Incontrol Assets to complement RexEngine. It is great to have those options.
     
  43. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    I had a chance to test Corgi and I absolutely don't like the architecture of the engine. Rex have much more clean architecture and it's more scalable than corgi.
     
    BeeZee and Joe-Mar like this.
  44. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    Hello Guys. Is someone using Easy Save 3?
    How are you setting it up?
     
  45. Joe-Mar

    Joe-Mar

    Joined:
    Apr 21, 2020
    Posts:
    12
    Oh and, do someone know why I'm getting hurt on BOUNCE when the enemy is more that 1 HP and it does not hurt me when it is 1 HP? I havn't figure why. HELP.
     
  46. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @san40511 By default the Attack component checks how long your attack animation is and enables the damage collider for the same duration. Handled around line 851 of the Attack component.

    The two places you'll want to look are in the Attack component - the AttackCoroutine on line 790 (specifically around line 851) and the Reset method on line 583. What is it exactly that are you trying to achieve? Are you looking to make the attack's damage collider activate for a shorter or longer duration? Depending on what you're trying to do, adjusting the duration of your animation might be the easiest and least destructive way, but definitely not the only one.
     
    BeeZee and san40511 like this.
  47. san40511

    san40511

    Joined:
    Oct 20, 2019
    Posts:
    29
    Thank you for your reply. I didn't want to touch the engine code. I found the solution inside the engine constructor. I deleted default melee controller and created new and put there attack player animation and removed all old melee sprites. Then I replaced default controller to a new where stored my attack animation and changed default value inside "attack animation" field to new and it fixed my issue.
     
    Bagnol likes this.
  48. jeremyfryc

    jeremyfryc

    Joined:
    Mar 11, 2014
    Posts:
    95
    Hello, that's a good question. It's actually one that I have asked myself. @BeeZee and I had a back and forth about it. You can read my original discovery of this error here:

    https://forum.unity.com/threads/rel...platformer-engine.477647/page-28#post-5622382

    He got back with me and let me know that this is a bug. You can read his response here:

    https://forum.unity.com/threads/rel...platformer-engine.477647/page-28#post-5622631

    Hope this helps. I'm sure he'll fix it in a future update. He provides excellent support and regular updates to the RexEngine, so, we'll just have to be patient and wait!
     
    BeeZee likes this.
  49. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    Something I eventually figured out on this one is that adding a Rigidbody2D to the child RexController (and setting it to Kinematic, so it registers collisions but doesn't add any physics movement on its own) seems to fix this. I think what was happening was that the BoxCollider2D on the RexController was doubling-up on collisions. The bounce operates by checking to see if your collision *just started* with an enemy, so because the collision was doubling up, the first call made the bounce work successfully, but then the second one damaged your player. The added Rigidbody prevents that from happening, since it stops the second collider from directing its OnTriggerEnter to the actual actor. (Sorry if that's long-winded, but I thought the full explanation might help!)
     
    jeremyfryc likes this.
  50. BeeZee

    BeeZee

    Joined:
    Sep 25, 2012
    Posts:
    657
    The death sound is on the RexController, under the "Audio Clips" subheading.

    That second one... is a really good point! There's just one AudioSource on the player by default, so it'll conflict with itself if it tries to play multiple things. I think my recommended fix would be to add more AudioSources to your player, and use those for certain things; footsteps would be an easy one that should probably have its own AudioSource. Footstep sounds get played in the MovingState.cs class, on line 347, if you'd like to change the audio source there.