Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

[Released] Smart 2D Colliders ( including Smart Platform Controller )

Discussion in 'Assets and Asset Store' started by CreativeSpore, Oct 15, 2015.

  1. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Are you using one of the character controllers included in the asset or your own controller with a SmartPlatformCollider?
    It could be caused because the skin of the collider is too thin. Could you post a screenshot with your setup for the SmartPlatformCollider?
     
  2. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    In the scene "08 - Demo New Platform Controller", occasionally the PlatformCharCtrl bounces down the slope a little. If I increase the Walking Acceleration and Max Walking Speed on the Platform Character Controller script, the problem becomes even more obvious.

    Update mode is on "On Update" on the Smart Platform Collider script. If I change it to "On Fixed Update", the problem is still there.

    If I change to the scene "05 - Demo Mario", the problem is also there (even more obvious). If I increase the Walk Speed, on the Smart Platform Controller script, the player flies off the edge, rather than walk down the slope. Update Mode for both as well.
     
  3. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    I did a bit more testing, on demo 08, it's actually unreliable on when I can re-produce this. It seems to happen half the time. Not sure exactly what causes it. Sometimes if I turn up the walk speed, the character moves up and down the slopes correctly, but on other times, the character simply doesn't go down the slope and runs off the edge. In demo 05 it always happens, so it seems like this is by design, whereas in demo 08 it comes across as a bug.
     
  4. claude

    claude

    Joined:
    Oct 24, 2013
    Posts:
    3
    ezgif.com-video-to-gif.gif
    I'm using the character controller included in the Asset.
    I made a gif so you can see what is happening. The first two jump are without walking(horizontal input) against the wall and the other two are with.

    PlatfromCharacterControler1.png PlatfromCharacterControler2.png
     
  5. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Thanks for the gif. It would check this and let you know what I found. Probably is caused by the update mode Update. This is used for a smooth movement in games at 60 FPS but it works only if the frame rate is high. A low framerate can be caused when you have the quality settings set to beautiful or fantastic. Anyway I will check if this was caused by a previous update and fix the issue.
     
  6. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    I will check this, but I need some time. There are a lot of cases, mostly when using the Update mode Update because this way the player is moved at different ratio depending on the frame Time. The best way to fix all these issues is using Update mode to Fixed Update.
     
  7. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    Okay thanks. As I mentioned earlier, I tried fixed update as well, and the issue was there too (I think, it's hard to replicate the bug now, seems to be working fine for now).

    Regardless, when I use Fixed Update, the player is jittery when it walks. Is this the expected behavior for Fixed Update?
     
  8. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    What version of Smart Platform Colliders are you using? You can see it in the file: "Assets\CreativeSpore\SmartColliders2D\changelog.txt".
    Also, what version of Unity are you using?
    I see something strange with your parameters. Moving Acc of 500 with Drag of 50 should give your a Moving speed of 0.

    You could experiment also that slow effect if the player were moved without acceleration, too fast, because the internal body would be in contact with the collider and it would case the player to be moved to the contact position.
    Anyway I am working in a fix for that case as well, so the player continue the movement in vertical in case the collision is horizontal.
     
  9. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Try the attached patch, it should fix the issue now, even I still don't know how you were able to walk with those values.

    This is what I have changed:
    upload_2018-1-12_17-7-21.png
     

    Attached Files:

  10. MagicPotion

    MagicPotion

    Joined:
    Jan 19, 2018
    Posts:
    1
    Thank you for a wonderful asset.
    I'd like to control a one - way collision with a play maker.
    Are you planning to create playmaker for Smart Collider ?
     
    CreativeSpore likes this.
  11. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Hi there!
    Thanks for using this asset.
    About your question, I am afraid there are no plans to create playmaker actions for this asset.
     
  12. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    New version of Smart Platform Colliders v1.1.5 available!

    Changelog v1.1.5:

    • ADDED CalculateSlopeAngle in SmartPlatformCollider to get the real slope angle at the bottom of the collider
    • ADDED SmartPlatformCollider public access in PlatformCharacterController
    • FIXED Wall Jump Bug when jumping on the wall
    • FIXED namespace issues when combining this asset with other CreativeSpore assets
    • FIXED slow vertical moving when falling or jumping while moving against a wall
     
  13. jingray

    jingray

    Joined:
    Feb 6, 2015
    Posts:
    53
    SmartRectCollider2D.FixedUpdate() create high spike on device android.
    Link image profiler. 1 game object with component Smart Platform Collider.
    How to fix ? Thanks publisher.
     
  14. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Hi there!
    In the screenshot I see 183 calls to SmartRectCollider2D.FixedUpdate. It looks like there are 183 smart colliders being updated.
    In case you don't know you can also change the Update mode to FixedUpdate to increase the performance:
    upload_2018-3-26_18-22-25.png

    If you don't find why you are calling to FixedUpdate 183 times with a single gameObject, send me a test project so I can check it my self. It could be a bug or something related with the Unity version you are using.
     
    jingray likes this.
  15. ury2ok2000

    ury2ok2000

    Joined:
    Dec 29, 2012
    Posts:
    46
    Hello, really enjoy your asset. I was wondering if there was a way to add some type of initial dash to movement. For instance from still position to movement left/right i would like a brief sort of dash before settling into normal speed.
     
  16. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    I depends on the player controller you are using. There is no special parameter for this, you need to do it manually:

    - With the SmartPlartformController, using physics, you can just add an initial velocity or apply a force for a while when it starts moving.
    - With the Platform Character Controller, using custom physics, you have to add the acceleration or initial speed through the m_platformPhysics attribute, like in this example where the acceleration is applied when moving right or left:
    upload_2018-5-7_13-47-43.png
     
  17. TrakanHolst

    TrakanHolst

    Joined:
    Jun 18, 2014
    Posts:
    2
    Hello, i'm having a issue, in some parts of my maps, the player can go through for no reasons here a video to show what i'm talking about (i sent you a message on your facebook page aswell for faster communication)

    https://www.useloom.com/share/fc47dfdb4bed47a1b554b8779b3fb643

    This is a big issue for me, if we could share contacts or reply on Facebook, that would be perfect :)
     
  18. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Hi there,

    Could you send me your test project to the support email? support(at)creativespore.com.
     
  19. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    Hello.

    When moving on a field with a wall on the ground with inclined ground and the ground up,You can not jump if you collide with that wall and keep entering in that direction.
    If you keep entering inputs on the wall side, it seems that the character moves up and down in a very small amount, so it may be the cause.
    Is there any other cause for this problem? Also, please let me know how to avoid it.

    smartCollider.png
     
  20. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Hi there,

    I think I have fixed that use case in the attached package. Please, try it and let me know if you find any other issue.

    Best regards,
    Juan
     

    Attached Files:

  21. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    Thank you for handling it quickly!

    However, when jumping and leaving the ground while entering in the direction of the wall, you can not jump once again because it remains in the aerial judgment.
    Also, at the time I asked a question, I made a midair decision as it was when I collided with the wall.
    Is it even possible to deal with this?
     
  22. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Are you using the SmartPlatformController or the New Platform Character Controller?
    I cannot reproduce the problem after the last modification. Are you testing the asset with the New Character Controller Demo?
     
  23. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    I was testing using the PlatformCharacterController in New Character Controller Demo.
    It certainly has been tested with SmartPlatformController, it seems that the problem has not occurred here as well.
    As a supplement, the character I used in the demonstration is PlatformCharaCtrl.Prefab, and I have not made any special adjustments.
     
    Last edited: Aug 3, 2018
  24. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    I have tested it using the attached patch and it works fine.

    SMC_SlopeWallFix.gif

    But if you still have issues, try changing the update mode to FixedUpdate:
    upload_2018-8-6_10-2-54.png

    Or increasing the inner skin:
    upload_2018-8-6_10-3-48.png

    Let me know if this helps.
     

    Attached Files:

    Last edited: Aug 6, 2018
  25. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    Thank you for information.
    I tried checking this way, but it did not matter if I turned OnFixedUpdate.
    But OnFixedUpdate seemed to be quite exciting.
    It is desirable to solve the problem with OnUpdate, but is it tough?
     
  26. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    I told that I could not do it with OnUpdate at the New Character Controller Demo, but when I tried it today I was able to do it without problems.
    But the first scene tested was a self-made test scene which I made pretty simple, I tried to apply a script I got modified there, but it was not fixed.
    I think that it is okay to pass this test project if it helps the solution, but how about you?
     
  27. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    I forgot to tell you that if you change the Update Mode in the smart collider, you also need to change it in the Camera Follow Controller component .
    upload_2018-8-8_19-56-3.png
     
  28. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    I want to make it work properly with my new self-made test scene.
     
  29. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Could you send me your test scene so I can test it?
     
  30. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    Yes, please check with the attached project!
    Please confirm with "SampleScene".
    Unity version is 2018.1.6f1.

    Mod edit: do not post files from the asset
     
    Last edited by a moderator: Aug 9, 2018
  31. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Change the k_SkinMinWidth to 0.001f
    upload_2018-8-10_9-49-55.png
     
  32. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    Thank you for information!
    After taking the above measures, it became no problem.
    I appreciate having a relationship with me for a long time.
    If there is something again please let me talk.
     
    CreativeSpore likes this.
  33. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    27,171
    DO NOT SHARE PAID ASSET CODE ONLINE. PM author.
     
  34. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    328
    The asset looks very cool and I think it's very practical.
    But how this compare to "Platform Effector 2D" performance wise. I understand that this asset is much more flexible in a lot of situations, but if I only want the One Way functionality, how will the performance compare.
     
  35. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    The performance should be good and it works with physic bodies so it could be possible to use Platform Effector and Smart Colliders.
     
    Stranger-Games likes this.
  36. c-nakai

    c-nakai

    Joined:
    Sep 11, 2018
    Posts:
    3
    Hello.

    When a character collides with an oblique wall as shown in the picture, the character is buried in the lower block.

    Is there a solution to this phenomenon?
     

    Attached Files:

  37. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    You need to play with the length of the side rays so it doesn't happens. So in the screenshot case, you would need to make the left and right side longer than top and bottom sides.
    By the way, that is considered as a crush of the player, for example if the player is crushed by a fallen platform. There is a parameter in one of the controller to make the player die in those cases.
     
  38. c-nakai

    c-nakai

    Joined:
    Sep 11, 2018
    Posts:
    3
    Thank you for your reply.

    After spreading the left and right rays, this phenomenon appears to have subsided.

    However, even if you expand the left and right rays, the same phenomenon occurs if the movement speed of the character is fast.

    Is this phenomenon known?
     
  39. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Check this post:
    https://forum.unity.com/threads/rel...latform-controller.361231/page-4#post-3587815
    And this one:
    https://forum.unity.com/threads/rel...latform-controller.361231/page-4#post-3592633

    That should fix your issues. It they persist, let me know.
     
  40. c-nakai

    c-nakai

    Joined:
    Sep 11, 2018
    Posts:
    3
    I confirmed those posts, but it did not lead to problem solving.

    Is this a problem that always occurs at the point where the collider of the ground and the wall cross it, or is it a product specification?
     
  41. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    This is an stuck case where the collider is stuck in between the floor and the ceiling. A way you can fix it is by checking when the player is stuck and moving it back a little.
    You can use the event OnCollision that has two parameters to indicate when the collider is stuck vertically or horizontally:
    upload_2018-9-23_14-12-57.png
     
  42. mngw01

    mngw01

    Joined:
    Jun 18, 2018
    Posts:
    13
    Sorry for my late reply.
    I will report the situation on behalf of c - nakai.
    After applying the processing I gave the suggestion, it seemed that the problem could be solved.
    Also, please contact us when there is consultation.
    Thank you.
     
  43. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    674
    @CreativeSpore So I am prototype an action RPG that plays like a platformer and I recently found your Smart Platformer Collider package and thinking about that as an alternative to the Corgi Engine that I have been currently prototyping with. While the Corgi Engine has been good in my initial prototype, that package has a ton of extra features that would be awesome if I were building a more traditional platform game like Mario Brothers instead of an action RPG that plays as a platformer (outside of the visual / physics aspects of a platformer game, it is really going to be an action RPG) and I just don't want all the extra stuff to get in the way and your package seems much more limited to the functionality I am looking for.

    Since I liked working with your super tilemap editor package and I know you provide greater support, I though I might give this package a try but I do have some questions.

    I am ultimately looking for a system that already provides most of the functionality for the math that is needed for platformer like physics since that is the part I would not be good with.

    First, I wanted to layout all the physics based interactions I am looking to be able to do:
    • moving back and forth
    • jumping (1 to x times)
    • walk up slope up to a certain angle (and preventing after that point)
    • climb ladders and such
    • hang off edges and pull up
    • fall damage
    You can watch this video for about 15 - 20 seconds, might give you a better idea of the feel of the "physics" system I am looking for:


    Based on the first video I watched in the assets store, there are 3 things I did not see which were the multiple jumping, cliff hanging, and fall damage. Are there things that are supported out of the box and if not, do you think it is something that can be added (not necessarily asking you to add them though if you wanted to that would be great but more about could those things be added even by me with the available APIs if needed and how much effort you think that would entail)?

    One other things I wanted to confirm since I was a little confused at this part of the first video, is it possible to have the player slide down if they jump on an angle of a certain degree that way the user can't just go up an 85deg wall by spamming jumps (it seemed like at ~5:10 of the first video that was possible but not really sure)?
     
  44. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    674
    @CreativeSpore A few other features I would be curious is they are supported out of the box:
    • wall jumping / climbing (something that was mentioned a while ago).
    • dashing
    • running
    • crouching
    • gliding
     
    Last edited: Oct 25, 2018
  45. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Hi there,

    Thanks for taking your time to consider this tool.

    About the questions:
    • For jumping, you have some extra parameters for multiple jumps or wall jumping in the PlatformCharacterController:
    upload_2018-10-28_16-44-47.png
    upload_2018-10-28_16-45-58.png
    • Walk up slope up to a certain angle (and preventing after that point) if possible changing the Max Slope parameter:
    upload_2018-10-28_16-47-12.png
    • Climbing ladder or areas is possible as well using the right layer for the collider:
    (See Climbing Parameters above)
    • Hang off edges and pull up is not implemented and neither is Fall Damage, but last one should be difficult to implement.
    • wall jumping / climbing (something that was mentioned a while ago).
    (Yes, it is implemented. See first question.)
    • dashing is not implemented but not difficult to implement.
    • running is not implemented, but it as easy as multiply the speed by a factor if running key is pressed
    • crouching is not implemented.
    • gliding is implemented. You need to play changing the drag values.
    Another thing that is implemented, not sure if that what you asked for about time 5:10 in the video is, when the character is moving down a slope, if the player is not jumping, the player is attached to the slope so it doesn't go down with small jumps. Also, when going up, the speed is the same as when moving over an horizontal surface.
     
  46. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,300
    @CreativeSpore

    Thanks for making such an awesome physics setup.
    I've had a couple of issues with the latest version that I thought might be important to address.

    Firstly, (on your New Platform Controller Demo scene) the one-way physics (see jumpthrough "!" boxes) make the character "stick" to them as he ascends. If using FixedUpdate as the update method, the physics break and he falls through the boxes at different places. At first I thought this was my setup, but the demo scene character fails here too. I'm using the latest Unity 2018 version.


    Secondly (but most importantly) -- I've had serious issues with implementing the character controller state system in my project. To be clear -- I would like to use a separate state system (in particular, NodeCanvas's behavior trees) to implement your character controller, but be able to easily modify the physics states to suit my specific needs. I want to be able to visually author more complex state/behavior flows without having to get into the nuts/bolts of the character controller.
    The problem is, I am unsure of where the physics decouple from the states and what states are necessary for the physics behaviors (such as falling down through jumpthrough platforms, or implementing my own jump/fall/move physics code).
    The biggest issue is that I am having a hard time understanding where the physics checks and the controller diverge so that I can modify the physics (or check for ground/ceilings/walls/slopes) in particular states and move the character manually via setting my own hspeed/vspeed independently.
    Is there am easy way to keep the basic locomotion while also providing an easy way to do these sorts of checks in separate (external) state systems?
     
  47. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    Hi there,

    Thanks for telling me about this bug. It was introduced with a previous fix for a different thing but I fixed it in the attached package.

    Let me know if you find any other issue.

    About the second part.

    The Physics are separated in the next components:

    SmartRectCollider2D and SmartPlatformCollider

    The SmartPlatformCollider is inherited from SmartRectCollider2D to fix some specific cases for platformer games.
    This component manages the collisions with the world. In case you are using a Physic body, it will also reset the velocity when colliding with a wall, floor or ceiling.

    SmartPlatformController and PlatformCharacterController

    They are two different controller used to control the player. Jumping, moving around, climb leaders or climbing areas, etc.
    SmartPlatformController was designed to be used with Unity physics. You can use it as template for your own controller to see how to use a player combining SmartColliders and a rigid body.

    PlatformCharacterController is controlling the physics with a custom class called PlatformCharacterPhysics. It is more specific for beginner users that want to have a full control of the player jump. It uses guides in the scene to easily configure the maximum jump, speed, etc

    If you are going to create your own controller I recommend you to check the Smart Plartform Controller instead.

    If you need any help, don't hesitate to ask and I will help you in the process.
     

    Attached Files:

    awesomedata likes this.
  48. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,300
    Thanks for looking into this! -- I appreciate the help.

    I do have 4 questions:
    • 1) Is there an easy way to bridge the current state setup to another FSM (for example, to one made in Node Canvas) without rewriting everything? --
      -- For example, there might be times I want to check if I'm in a particular controller eState, but other times I want to simply disable normal physics state changes altogether (and use my own physics.)
    • 2) How might one create a temporary "air-dash" state using the SmartPlatformController?
    • 3) What is the VPad variable and what does it reference? -- Can't seem to find its origin. D:
    • 4) Is there any way you can add an easy method (in the collider) to set its hspeed and vspeed (separately) to absolute values that don't impact the collider's collision-detection? -- I also would like to make my states set movement in a particular direction at a particular (absolute) speed too.
     
    Last edited: Dec 19, 2018
  49. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,172
    I answer you below:
    • 1) Is there an easy way to bridge the current state setup to another FSM (for example, to one made in Node Canvas) without rewriting everything? --
      -- For example, there might be times I want to check if I'm in a particular controller eState, but other times I want to simply disable normal physics state changes altogether (and use my own physics.)
    Yes, you only need to set the actions externally. Like PlatformCharacterInput does.
    But it is not a FSM. They are a set of actions that are enabled or disabled. It is more like an input or an order you give to the PlatformCharacterController, like Jump, Move Right, Crouch, Long Jump, Slash, etc.
    Then you check layer if an action is set to perform the action.
    You can use a FSM if you check the action state and modify it as you wish.
    For example, you are in Idle state and activate a transition to Jump. This transition or the Jump state itself will set the Jump action:
    m_platformCtrl.SetActionState(eControllerActions.Jump, true);
    This will make the player to jump.

    • 2) How might one create a temporary "air-dash" state using the SmartPlatformController?
    Set the gravity to 0 to disable it, and apply a velocity to one side, then enable it again.
    • 3) What is the VPad variable and what does it reference? -- Can't seem to find its origin. D:
    VPad is a virtual pad. Is used when you create a build for a handheld device. Rotating the device will move the player right or left and tapping the screen will make it jump.
    • 4) Is there any way you can add an easy method (in the collider) to set its hspeed and vspeed (separately) to absolute values that don't impact the collider's collision-detection? -- I also would like to make my states set movement in a particular direction at a particular (absolute) speed too.
    You cannot set the speed in the collider, the collider only manages the collisions with the world to make sure you don't trespass any wall. You can move at an absolute speed by code directly.
    Be sure to avoid updating the custom physics:
    m_platformPhysics.UpdatePhysics(Time.deltaTime);
    And just move it like this:
    transform.position += absoluteVelocity * Time.deltaTime;
     
  50. henkesky

    henkesky

    Joined:
    May 23, 2015
    Posts:
    36
    @CreaticveSpore,i have trying to use your followController script on my camera, but am getting awful result. The camera cant seem to find the player at runtime. Am not getting an error message, so i cant tell what the problem is,. Here is my modified version of the code. In the code i try to find the ork player gameobject, then sets it transform as the target transform. I also used a coroutine to delay the execution in other to allow time for ork to spawn the player. During the runtime/playmode, i noticed through the transform slot that player has been set as the target, but is still not shown in the game mode
     

    Attached Files:

unityunity