Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. Adoll

    Adoll

    Joined:
    Apr 16, 2016
    Posts:
    20
    Many thanks.
    The problem is solved by moving transform.rotatearound to FixedUpdate() alone. The excution order does not matter in this case.
     
  2. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Great! Remember to move always the movement code to the FixedUpdate.
     
  3. CreativeSpore

    CreativeSpore

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

    I have improved the smart colliders and added support to use the smart colliders when the position is updated in the Update method instead of in the FixedUpdate with an UpdateMode atribute.
    The player controller use this new update mode to allow a smooth movement at maximum FPS.

    v1.1.2 Changelog:
    • Added new constant for collider separation k_colliderSeparation. Previously k_SkinMinWidth was used instead.
    • Added a update mode for smart colliders. Now it can be updated in FixedUpdate and Update( allowing a smoother movement)
    • The PlayerCharacterController has been updated to work in Update allowing a movement at maximum FPS.
    • Added an update mode in FollowController used by the camera to follow the player allowing to set the right mode depending on when the followed object updates its position.
    • Added support for multi editing in SmartRectCollider
    • Added LockDistanceToTarget to the RotateTowards behaviour because for imprecision errors, the radius was being changed each frame.
    • Renamed Real Velocity to Instance Velocity
    • Fixed jittering issues.
    • Fixed some issues with unity versions 5.3 and 5.4
     
  4. CreativeSpore

    CreativeSpore

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

    v1.1.3 changelog:
    • Added gravity Scale to new controller
    • Fixed bug making the player to collide with it's own collider
     
  5. CreativeSpore

    CreativeSpore

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

    v1.1.4 changelog:
    • Added tooltips to SmartPlatformController parameters
    • Added Inner Skin Configuration to the SmartRectCollider2D inspector
    • Improved Dynamic collision management
    • Moved player controller to PlayerControllers folder inside prefabs
    • Fixed changing smart collider Size or Center for animation was not updating the collider
    • Fixed OnSmartTriggerStay2D was not being called in some cases
    • Fixed SpringBehaviour to impulse the player when jumping over it
     
    meapps likes this.
  6. rygaar

    rygaar

    Joined:
    Mar 28, 2009
    Posts:
    63
    Hi, has double jump been implemented yet?
     
  7. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Not yet, but it would be easy to be implemented. I will try to add it to the next release.
    If you need help with it let me know, basically an integer counter should do the trick.
     
  8. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    Hi Juan,

    I bought your asset, but I think there are some bugs or maybe it is my fault.

    I put on default SmartRectCollider2D, and increase the force by AddForce. When the object climbs the slope - it is smooth. When it is sliding down the slope, the object jitters.

    I would like to know the solution to this. I bought this asset to skip raycast implementation, as time is tight on me
     
  9. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,
    Are you using the Smart Platform Controller or the Platform Character Controller?
    The Platform Character Controller should work fine, but it is not managed by Unity Physics. Maybe you are having issues because you are using the rigidBody to apply forces. You should use the gravity property instead.

    If you are using the Smart Character Controller, it should work as soon as you apply enough gravity to avoid the player to make small jumps while going down.

    Using a simple SmartRectCollider2D should be the same.

    How are you applying the force? Could you send me a test project so I can test it my self?
     
  10. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    I have sent you the sample project with commentary. Thanks for you consistent quick replies. I have sent it through the email.
     
  11. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I have found the problem here:
    upload_2017-4-11_21-22-53.png
    You are seting the velocity to Zero, and the gravity is not applied properly because the speed is set to 0 each frame.
    I know you are doing this to stop the player from moving when no key is pressed, but you should use the drag value instead to stop the player from moving when not adding a force to the body.
    upload_2017-4-11_21-24-56.png

    Comment the line pointed by the red arrow and add some Linear Drag to the player. You could need to increase the applied force.
     
  12. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    Great, I will try that. What about detection when you touch the ground?
     
  13. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    Ok I figured that out, how about adding a simple script that will move left and right to the collider points position on the surface. Bare minimum without adding states? I think it will be better.
     
  14. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I am not sure what do you mean about moving the collider point position. Could you explain it?
     
  15. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    Stick to the surface as he walks along regardless of angle. I got mine working a good condition. But can you modify the script of PlatformController.cs to only move left/right and jump independent of States.

    For instance, if I attach the script to my object with a rigidbody, the player should be able to move left and right and jump.

    Also, can you imitate a OnCollisionStay(Collinsion2D), OnCollisionEnter2D(Collision2D) method into your project?

    I am having a lot of difficulties modifying everything to use your product. I have to make a lot of changes to my project.
     
  16. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    The files that I gave you, I just want to implement that. But I cannot do that because I cannot implement things like onCollision2D(Collision2D target), etc

    The moment I add your Platformer, the colliders and triggers break.

    If you cannot implement those your asset is useless to me
     
  17. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    These messages are implemented in a similar way with other names:
    Code (CSharp):
    1. /// <summary>
    2. /// OnSmartCollisionStay2D is called once per frame for every SmartCollider that is touching collider.
    3. /// </summary>
    4. void OnSmartCollisionStay2D( SmartCollision2D collision )/// <summary>
    5. /// OnSmartTriggerStay2D is called once per frame for every SmartCollider other that is touching the trigger.
    6. /// </summary>
    7. void OnSmartTriggerStay2D( SmartContactPoint smartContactPoint )
     
  18. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    But I did that in the project I sent you and it does not work. If you wish, you can make it work and send me a sample project. Just an box, touching another rectangle as Ground would do.
     
  19. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    Now it is not working.


    Code (CSharp):
    1.     void OnSmartCollisionStay2D(SmartCollision2D collision)
    2.     {
    3.         Debug.Log(collision.gameObject.name);
    4.     }
     
  20. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    12 days have passed and my problems have not been solved. I have given you the sample project, so please kindly implement it so it works. Otherwise may I please have a refund.

    I am sorry for being harsh, my patience is growing thin. 12 days is almost half a month.
     

    Attached Files:

  21. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there!

    Sorry for that. I thought I gave you the solution in the other post but I see where the problem is.
    The events OnSmartCollisionStay2D and OnSmartTriggerStay2D are called in the object where it collides with.

    You need to use the events OnCollision and OnSideCollision:
    Code (CSharp):
    1.  /// <summary>
    2. /// Collisions event triggered when there is a collision with the world colliders
    3. /// </summary>
    4. /// <param name="vSolveDisp">The displacement done to solve the collision</param>
    5. /// <param name="isHorizontalStuck">If the collision could not be solved because the smart collisions was stuck horizontally</param>
    6. /// <param name="isVerticalStuck">If the collision could not be solved because the smart collisions was stuck vertically</param>
    7. public delegate void OnCollisionDelegate(Vector3 vSolveDisp, bool isHorizontalStuck, bool isVerticalStuck);
    8. public OnCollisionDelegate OnCollision;
    9.  
    10. /// <summary>
    11. /// Collision event triggered per each side of the smart collider
    12. /// </summary>
    13. /// <param name="collision">This smart collider</param>
    14. /// <param name="collidedObject">The collided object</param>
    15. public delegate void OnSideCollisionDelegate(SmartCollision2D collision, GameObject collidedObject);
    16. public OnSideCollisionDelegate OnSideCollision;
    17.  
    You can see some examples of how to use these events in the included player controllers: SmartPlatformController and PlatformCharacterController.

    I have modified your test project to use these events and tell you when you are grounded.
    I have attached the component SmartPlatformCollider (it inherits from SmartRectCollider2D but it's more optimized for platformer controllers and included the method IsGrounded to check when you are touching the floor).
    Also I have added moving right and left and jumping only when you are on the floor.

    If you need any more help don't hesitate to ask. I will try to help as soon as possible.
     

    Attached Files:

  22. Seiraniel

    Seiraniel

    Joined:
    Dec 23, 2014
    Posts:
    13
    Hi! I just downloaded your asset a few days ago and I like how lightweight it is. I have tried others which come with all sorts of extras you don't need.

    I have an issue however. I'm still playing around with it and I noticed that my charactet occasionally (every couple of frames) get stuck in the floor. It doesn't show the charactet falling through but with the gizmos on you can see its collider falling or something. It causes the character's movement to stutter everytime.

    I'm using Unity 2017.1 and the latest version of both Smart Platform Colliders and Super Tileset. I'm also using my own input script (which is a wrapper for Rewired).
     
  23. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there!

    The gizmo falling down is caused when the player is still applying the gravity because Unity paint the gizmo asynchronously with the rendering. It happens only while playing but shouldn't be a problem in the final game because the collider is moved before rendering the sprite or object.
    For example, if you use Unity physics, sometimes the gravity is applied after FixedUpdate is called, making the player to move down a little after placing it properly over the ground. This is fixed by placing the transform position back to the position is was set during the FixedUpdate and restoring it after rendering.

    Anyway, the stutter issue shouldn't be happening. Maybe it's caused for your current configuration.
    What controller are you using? PlatformCharacterController or SmartPlatformController?
    If you could send me a test project I will check it myself to find the issue. It can be just the collider, removing all the graphics or leaving just one sprite.

    Finally it could be something related with synchronization. You can update the smart collider every Update & FixedUpdate or only every Update. If you follow the player with a Camera and the camera is moved during the Update you could see it stuttering not because of the collider but because of the camera movement.
    I will change the controller in the next update to avoid applying gravity if the collider is grounded, I think this will fix a lot of stuttering problems.
     
  24. Seiraniel

    Seiraniel

    Joined:
    Dec 23, 2014
    Posts:
    13
    I tried in a new project with the "08 - Demo New Platform Controller" scene. I believe I was using this same controller for my game (I reverted to my previously used controller after testing yours in my project so I couldn't tell you which it was.)

    I have the same issue in that scene as I did in my own project but it's less noticeable for some reason (maybe a framerate-dependent issue? I had about 200 FPS)

    I then built the project for release and it wasn't there anymore at all (I did experience jittering when going down slopes but I may be nitpicky.)

    It's possible this issue really only happens in the editor. I'll continue investigating. I'm considering moving away from Unity at this point because of all these issues I've been having with character control and other parts of the engine (this project has been in the works for over two years, by the way) so your asset may end up saving me many future headaches.

    Thank you for your answer.

    I would also like to add for anyone reading this that this is still the most solid character controller solution I've tried (I tried Prime31's, Corgi and others and they all have much worse issues.)
     
    awesomedata likes this.
  25. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Thanks for your final commentary. I'm glad you like this controller ;)
    It will make some tests with low frame rate in the editor. I already fixed some issues related to the low framerate and it was supposed to be fixed, but maybe there is something still remaining.
    One of the reasons it could be working fine in the release could be the framerate, but also the editor works different and I have some code related with the rendering (to place the player to the right position in case it was moved by physics between FixedUpdate and Rendering) and in the Editor you could have two cameras rendering the player if you have the Scene View and the Game View active. Shouldn't be a problem with this, but maybe I missed something in the code to manage more than one camera.

    EDIT: I have made some test with low framerate (using fantastic Quality and creating a lot of spheres with a SmartRectCollider2D) and it looks like it was working even with the Scene and Game view at the same time.
    But it doesn't mean it is not working in other cases, so don't hesitate to let me know if you find any issue and send me a video or a test project so I can fix it.
     
  26. Seiraniel

    Seiraniel

    Joined:
    Dec 23, 2014
    Posts:
    13
    I decided to make my own Character Controller while using Smart Colliders. It works exactly like I wanted now. I have to say that not having to worry about collisions really makes the whole thing much easier.

    I made a Castlevania clone in C++ using SDL2 in my second year of college and collisions made me want to tear my hair out.
    In the end, I had to remove slopes entirely so I could actually bring it closer to completion.

    Anyway, everything works fine with Smart Colliders except that I have an issue where the red rectangle gizmo (I checked the source code and it's used to re-position the character or something?) occasionally when landing down (like 1 out of ten times maybe.) Speed doesn't appear to be effected since my controller's velocity in X is constant but it does weird things when climbing down platforms. The red rectangle stays stuck and appears every frame until my character jumps again. I'm currently looking at how you implemented re-positioning your character controllers when things like this happen but so far nothing appears to fix it.

    I included a screenshot of the issue.

    EDIT: Whenever it does that, SmartCollider.IsGrounded() returns false. I apply gravity only when it's not grounded so that's why it looks like it keeps trying to go down.

    EDIT 2: I gave it a super high bottom skin and it doesn't seem to happen. My guess is that it goes just a little too far down between two frames and the bottom raycasts' origins are inside the bottom collider which means that it doesn't detect it at all. At least that's what my investigation so far shows since the bottom raycasts don't detect a collider when that happens.

    EDIT 3: I finally found the problem. Long story short: The issue was in my own code.
    Longer story: I had started implementing a state system with things such as jumping, walking or falling and didn't finish it but used it anyway in some checks and forgot I did. For some reason, whenever I held the jump button until the character started falling, it would not get out of the falling state even if it touched the ground. So what happened was that it was pushing through the floor and the SmartCollider probably detected it as trying to fall through every frame or so.
     

    Attached Files:

    Last edited: Sep 10, 2017
  27. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Good to know you found the solution.
    Just to explain it, the red rectangle appears when the body of the smart collider touch a collider and needs to be re positioned. It usually happens when you don't reset your speed, for example the gravity, once the translation distance is bigger than the skin, the body will touch the collider and the red rectangles will indicate you that. That is the reason you don't see the red rectangle when the skin size is bigger enough.

    Anyway, let me know if you find any other issue.

    About your Castlevania Project, platformer collisions are indeed a pain in the neck with so many cases to be taking into account. I also made a lot of tries until I created this asset that I hope solve most of the cases, including slopes :)
     
    Seiraniel likes this.
  28. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    New version of Smart Platform Colliders released!

    Changelog v1.1.4.4:
    - Added more jump parameters to PlatformCharacterController for jumping: airJumps, wallJumps and wallPushSpeed
     
  29. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    142
    Hi, I have been looking at your asset and I was wondering if it can do the following:

    Place a smart collider on the player and another smart collider on a block, be able to push a block, pick up a block, jump through a oneway platform with the block, push the block against another block? Thanks!
     
  30. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    You can push the block with a smart collider. There is an example in the Demo 1: Moving Platforms, with the box over the house roof.
    Also, you can push two blocks:
    2017-09-17_12-22-59.gif

    You can also jump throw a one way platform, but there is no script to manage to pickup a block.
     
  31. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    142
    I have purchased and looked at the pirate ship demo as I saw a block in that example, however when I use box collider2D and rigidbody2D it floats in the air?
     

    Attached Files:

  32. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    142
    When I turn on On Fixed Update, the player drops into the floor. Is that normal?

    I want to use the rigidbody2D and collider2D approach, but ran into some issues:
    When you have isTrigger turned off on a collider2D the block rises up.
    When you have isTrigger enabled and set UpdateMode to to OnFixedUpdate the object goes into the floor.
     

    Attached Files:

    Last edited: Sep 17, 2017
  33. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    It happens with 2d colliders. For some reason it floats a little bit in the air. It is not visible if the collider is bigger enough, but in case the pixel per unit is 100 (by default) and the tile is 32x32 pixels (the collider is 0.32x0.32) you can see that effect. To avoid that, use a pixel per unit of 1. Using 3D colliders or use only Smart Colliders can also fix that issue.
     
  34. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    The gizmos are not synchronized with the real position. The gizmo show you the position during the Update, but before rendering the gameObject, the objects is moved to the calculated position free of collisions. When you change to FixedUpdate it is updated less often so you see an small offset of movement in the gizmo (only while playing, because the gravity is being applied).
     
  35. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    142
    I don't see no offset, the player is permanently walking through the ground. If he had boots, you wouldn't see them. Looks like a bug to me.
     
  36. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I couldn't reproduce this bug in the Demo1 and Demo8.
    Demo1 uses a player controller based on Unity Physics. In this case, use update mode FixedUpdate was not causing any issue at all.
    Demo8 uses a player controller based on custom physics updated during the Update event, so changing the smart collider update mode to FixedUpdate was causing a jitter movement, but it was always over the ground.

    Could you tell me what demo are you using where the player is moved under the ground? If you are using your own demo, can you send me a test project to check it my self? or send me a screenshot where I can see the skin and body gizmos?
     
  37. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    142
    I see what I have done now, I have made the BoxCollider2D the same size as the SmartCollider in order to trigger collisions. So how do I trigger events using your asset?
     
  38. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Be careful with the 2D colliders if the size of the collider is too small. It doesn't work very well in these cases, for example, in the Demos the pixel per unit is 100 and it makes the colliders too small for the player size.
    If you use pixel sprites, try changing the pixels per units to 1.

    About your question:
    You can use the SmartCollider events:
    Code (CSharp):
    1. /// <summary>
    2. /// OnSmartCollisionStay2D is called once per frame for every SmartCollider that is touching collider.
    3. /// void OnSmartCollisionStay2D( SmartCollision2D collision )
    4. /// </summary>
    5. protected const string k_messageOnSmartCollisionStay2D = "OnSmartCollisionStay2D";
    6. /// <summary>
    7. /// OnSmartTriggerStay2D is called once per frame for every SmartCollider other that is touching the trigger.
    8. /// void OnSmartTriggerStay2D( SmartContactPoint smartContactPoint )
    9. /// </summary>
    10. protected const string k_messageOnSmartTriggerStay2D = "OnSmartTriggerStay2D";
    They work similar to OnCollision and OnTriggetCollision but with some differences.
    They are sent when a collision has been detected against a Unity collider 2D or 3D, but not between SmartColliders.

    Also, you can attach a function to these events:
    Code (CSharp):
    1. /// <summary>
    2. /// Collisions event triggered when there is a collision with the world colliders
    3. /// </summary>
    4. /// <param name="vSolveDisp">The displacement done to solve the collision</param>
    5. /// <param name="isHorizontalStuck">If the collision could not be solved because the smart collisions was stuck horizontally</param>
    6. /// <param name="isVerticalStuck">If the collision could not be solved because the smart collisions was stuck vertically</param>
    7. public delegate void OnCollisionDelegate(Vector3 vSolveDisp, bool isHorizontalStuck, bool isVerticalStuck);
    8. public OnCollisionDelegate OnCollision;
    9.  
    10. /// <summary>
    11. /// Collision event triggered per each side of the smart collider
    12. /// </summary>
    13. /// <param name="collision">This smart collider</param>
    14. /// <param name="collidedObject">The collided object</param>
    15. public delegate void OnSideCollisionDelegate(SmartCollision2D collision, GameObject collidedObject);
    16. public OnSideCollisionDelegate OnSideCollision;
    You can find some examples of use in these files:
    • OnSmartCollisionStay2D:
      • SpringBehaviour.cs
    • OnSmartTriggerStay2D:
      • KillsOnTouch.cs
      • RocketBehaviour.cs
      • SnailBehaviour.cs
    • OnSideCollision:
      • PlatformCharacterController.cs
      • SmartPlatformController.cs
    • OnCollision
      • SmartPlatformController.cs
    If you have any question don't hesitate to ask.
     
  39. Seiraniel

    Seiraniel

    Joined:
    Dec 23, 2014
    Posts:
    13
    Just making sure I'm on the right track here. If I want to implement crouching with my character, is resizing the SmartCollider the only thing I need to do?
     
  40. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Yes, you can just resize the collider, pero also, you need to move the center so it is positioned properly.
    To change the heigh of the smart collider, change the Size.Y property in the inspector view, the modidy the Center.Y position also to place the collider properly if needed. For example, if you want to move the top side down, keeping the bottom side at the same position, you should move down (subtract from Center.Y value) half of the value you subtract to the Size.Y.
    For example if Size.Y = 3 and Center.Y = 0.2 and you need to halve the height, so Size.Y = 1, then Center.Y = 0.2 + (1 - 3) / 2 = 0.2 - 1 = -0.8.
     
  41. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    I can't find a combination for acceleration+drag to get a max speed that I desire. For example, I can set a desirable acceleration and drag, but the top speed is too low. Is there an easy and safe way to override the max speed to something arbitrary? I figured changing this line of code would do it (inside PlatformCharacterPhysics.cs):

    Code (CSharp):
    1. public float SolveMaxSpeedWithAccAndDrag(float acc, float drag) {
    2.     return ((1 - drag * Time.fixedDeltaTime) * acc * Time.fixedDeltaTime) / (drag * Time.fixedDeltaTime);
    3. }
    And changing it to return, say an arbitrary number. But this doesn't really work. Any suggestions?
     
    Last edited: Nov 26, 2017
  42. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    Oh I just noticed you have another script "SmartPlatformController" that has extra variables for controlling walk speed, etc. I'll take a look at that, I guess that might solve my issues.
     
  43. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    The method SolveMaxSpeedWithAccAndDrag is only used to draw the guides with the jumping prediction.

    You can change the maximum speed in the inspector view:
    upload_2017-11-27_13-41-27.png

    SmartPlatformController is the controller version using Unity Physics. It's less precise but could be what you are looking for if you prefer using Unity physics.
     

    Attached Files:

  44. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    That's what I mean though, as you showed in your screen shot, the slider is at the max value, so you can't go any higher than that right? Since it all depends on acc+drag. However, I've set an ideal acc+drag, but I want the max speed to go higher (without adjusting the acc+drag). Is this possible?

    I'd prefer to use your script, as I find Unity's built in methods not precise enough. I have my own scripts which do similar computations to yours to achieve precise collision detection, though I'd prefer to go with yours since I find it a bit more robust in general.

    Thanks for your time.
     
  45. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    How it works, the acceleration is increasing the speed by the time and the drag is like a friction that is increased with the speed so at some point the friction force is equal to the acceleration. So the Max reachable speed is calculated based on those values Acceleration and Drag. You cannot change it without changing one of those values.
     
  46. claude

    claude

    Joined:
    Oct 24, 2013
    Posts:
    3
    Hi,

    Is there a way to remove the wall sliding on the PlatformCharacterController?
     
  47. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    What do you mean? Stop the player from moving down when going against a wall while falling down?
     
  48. Andrew122222

    Andrew122222

    Joined:
    Jul 8, 2012
    Posts:
    28
    Okay thanks.

    Another question; walking down slopes seems to work well, except when the player speed is high. Is there a way to ensure the player walk down the slope regardless of the speed (rather than run off the edge, or bounce down)?
     
  49. claude

    claude

    Joined:
    Oct 24, 2013
    Posts:
    3
    When the player touches the wall he moves down on a lower speed and sticks to the wall. I want the player to fall in the same speed whether he touched the wall or not.
     
  50. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Are you using Update Mode: Update or Fixed Update? I want to make some tests with the same setup.