Search Unity

[RELEASED] Complete Physics Platformer Kit

Discussion in 'Assets and Asset Store' started by Greg-Sergeant, Oct 2, 2013.

  1. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    I had used a capsule collider a while ago but I remember encountering some weird issues with it so I switched it back. Although at the time I was looking to set the player's transform.up based on the slope they were currently walking on (so the player would conform to hills and such) so I think this conflicted with the capsule and I switched back. Granted I didn't end up using that anyway but as of yet, I have yet to see a reason not to use the box collider.
     
  2. IntegraC

    IntegraC

    Joined:
    Jan 20, 2015
    Posts:
    16
    On flat ground it's fine but moving up and down on inclines is the reason I can't use a box collider. I even looked at the code for player move and character motor and no mention of specific sizes needed on the collider. Guess I'll keep trying to play with it.
     
  3. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    I was pretty picky about always seeing the model touching the ground on slopes and such but after playing Mario 3D World and seeing Mario "hover" on stairs (obviously they used a flat slope for the collision on them), I don't feel as bad. :D
     
  4. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I'm alive, just haven't used this kit in a long long time D: Lately I've been just programming my games by myself without using other stuff as starting points. But I still read this thread from time to time XD
     
    Fowi likes this.
  5. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    But I thought you were expanding upon Infection (which didn't Sebastian code)? :p
     
  6. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    I'm working on a expanded version of infection, but I discarded Sebastian's coding of it and I'm redoing it all based on the Coop Action Game Kit ;D

    I'm also working on 6 small prototypes for school, and one other personal project not ready to show/talk about a local multiplayer vs game.
     
  7. iTarek

    iTarek

    Joined:
    Feb 1, 2015
    Posts:
    1
    Hi
    Any chance to help me have an iOS pad controller without buy anything from store
    Thank you
     
  8. blackorchidgames

    blackorchidgames

    Joined:
    Jan 6, 2015
    Posts:
    8
    You could code your own controls, although I think it'd be much simpler to just buy a pre-made package to do it for you.
     
  9. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    https://www.assetstore.unity3d.com/en/#!/content/15233
    This is free... But you need to know a little bit of programming to implement, not a lot though.
     
  10. muringa

    muringa

    Joined:
    Feb 4, 2015
    Posts:
    5
    Hi everyone, i have started with this kit yesterday, thanks for Daniel for theses addons.
    I have a question, when the scene starts, the player starts in a jump state, anyone knows how i can fix this??
    it has to start on the ground and not jumping.
    thanks in advance for the reply!!
     
  11. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Check your animation controller to make sure that "Idle" is the default state. But given the fact he's jumping, I'm willing to bet that you have the player set to start too close to the ground and/or somewhat in the ground. This will force the player up at the scene start. Just raise them off the ground by a bit and it should resolve it.
     
  12. imma01100

    imma01100

    Joined:
    Apr 9, 2014
    Posts:
    7
    Hello again besus can you give me little idea of water i mean what the idea of particle work when player enter into water i saw in your dev blog and also one more thing how i stop player from moving while punching i m using DanielSnd melee script and thank for great tip about logic
     
  13. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    No doubt that enemies in this kit are quite basic, so with just a simple Raycast to check what is ahead of them, you can make them seem a bit more intelligent (and less prone to blindly running off of edges). :)
     
  14. sleekdigital

    sleekdigital

    Joined:
    May 31, 2012
    Posts:
    133
    I don't know if this has already been mentioned or not, but just in case... I'm pretty sure line 136 in Throwing.cs is incorrect and it is allowing the character to pick things up even when there is something above their head...

    Code (CSharp):
    1. if(!Physics.CheckSphere(holdPos, checkRadius, 2))
    The comment above this line reads:
    //if there is space above our head, pick up item (layermask index 2: "Ignore Raycast", anything on this layer will be ignored)

    The last parameter of Physics.CheckSphere is not the index of a layer to ignore, it represents a bitmask of the layers to include. The default value is "DefaultRaycastLayers", which means all layers except the "Ignore Raycast" layer which is exactly the way we want it. In other words, just change it to...

    Code (CSharp):
    1. if(!Physics.CheckSphere(holdPos, checkRadius))
    On a somewhat related note... I know many of you will defend the author to the death :) but I feel like this kit could use an update. The kit does provide a very good value for the price and its great that the community has pitched in. However I think the bug fixes and some of the additions belong in the source code so people don't have to go digging through 15 pages to find them. Reading through those pages I noticed that there was quite a bit of talk about things getting added/updated, and it is a little disappointing that those things haven't happened.
     
  15. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Nice catch! I never even looked in to that statement after having noticed I could still pick up an object while holding one. Instead I did things the "lazy" way and added a "&& if !heldObj" to the OnTriggerStay check. :p

    Actually, I agree with you. Especially with Unity 5 coming out soon. Granted I was able to import the project without issue (only having to change the collider type on the frame object), it would still be nice to see "Unity 5 compatible" going-forward. That and earlier in this thread Greg had even asked Daniel for permission to include his addon scripts in future updates to the kit.

    At what point does an asset become abandonware and allow others to improve upon (and sell) it because I would consider replacing it on the asset store (with some of my additions) if the legalities checked-out. :D
     
  16. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    hi,

    Has anyone rope script for Complete Physics Platformer Kit ?

    or trying to implement "QuickRopes Rope Physics"

    +++
     
    Last edited: Feb 11, 2015
  17. sleekdigital

    sleekdigital

    Joined:
    May 31, 2012
    Posts:
    133
    Another bug related to Throwing.js... If you pick up an object and the joint breaks due to exceeding the torque or force limit, heldObj doesn't get set to null and the held object's rigidbody settings don't get reset either. This can lead to a number of issues. For example, if you try to pick up an object again, you end up sort of pushing it because the code thinks you are still holding something and it tries to throw. I haven't decided how to fix that one yet... time for sleep.
     
  18. sleekdigital

    sleekdigital

    Joined:
    May 31, 2012
    Posts:
    133
    I ended up using a simple coroutine to keep an eye on the joint...

    Code (CSharp):
    1.  
    2. private IEnumerator heldObjCheck()
    3.     {
    4.         while (joint != null)
    5.         {
    6.             yield return new WaitForSeconds(.7f);
    7.         }
    8.         if (heldObj != null)
    9.         {
    10.             DropPickup();
    11.         }        
    12.     }
    13.  
    14.  
    DropPickup is the same as ThrowPickup() except it doesn't play sound or add force. I start this coroutine when an object is picjed up.
     
  19. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    I think I've only broken a joint once in all of my play-testing. Trying to recreate it now, I just can't seem to. :p
    What would be the simplest way to do so willingly? Ha ha.
     
  20. sleekdigital

    sleekdigital

    Joined:
    May 31, 2012
    Posts:
    133
    For example... If you are carrying an object and you walk under a low platform that hits the object you are holding. Common enough scenario in some puzzle platformer type games.
     
  21. sleekdigital

    sleekdigital

    Joined:
    May 31, 2012
    Posts:
    133
    Sorry, I guess I introduced this bug myself... That joint is normally unbreakable, which may not be considered a bug, but seems like an oversight at least. If you try to do this with the code as is with a non breakable object, you end up with the carried object bouncing around frantically behind you. :) So I made the joint breakable.
     
    Last edited: Feb 12, 2015
  22. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    I was going to say, I tried to recreate it just now in the scene view by pulling the object around manually and no matter how vigorously I moved it, the character pulled along with it. :)
     
  23. sleekdigital

    sleekdigital

    Joined:
    May 31, 2012
    Posts:
    133
    Yeah, its funny how a fixed unbreakable joint turns into something more like a springy joint.
     
  24. ibps13

    ibps13

    Joined:
    Oct 6, 2012
    Posts:
    113
    Hi Besus,

    Any chance to share tutorial for grab dynamic object ?

    Very nice work indeed

    :)

     
  25. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335

    hi,

    You can mix Throwing.cs and elevator script, i think. Daniel post it, if i remember.

    ++
     
  26. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    335
    hi,

    anyone has writing a new gui manager script for using new ui system ?


    ++
     
  27. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    It's a little more complicated than that. :)

    At the simplest level, I am using the ledge grab code that already exists for static objects and when grabbing on to a dynamic one, I set the players rigidbody speed to match that of the object. It's similar to the code that already exists in the PlayerMove script to help keep the player on moving platforms (only applying it to the y-axis instead of just x/z).
     
  28. ibps13

    ibps13

    Joined:
    Oct 6, 2012
    Posts:
    113
    Thx Tequyla and Besus, I try it
     
  29. nicolasbulchak

    nicolasbulchak

    Joined:
    Aug 9, 2013
    Posts:
    37
    Just finished skimming this entire thread! This stuff is amazing. Me and few of my friends are trying to learn how to build and develop games, and this kit has already been a HUGE help! Thanks to everyone for posting your updates, your scripts, your questions and solutions. This is very exciting!
     
    Fowi likes this.
  30. lukasdragon

    lukasdragon

    Joined:
    Oct 23, 2014
    Posts:
    7
    I need some help, all my enemies are super slow if vsync is not on :(
     
  31. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
  32. nonameu

    nonameu

    Joined:
    Apr 8, 2014
    Posts:
    18
    hi people,

    I'm using the climb script DanielSnd provided. Need to change the player's rotation to always facing the ladder. See below.

    Thanks
     
  33. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    http://docs.unity3d.com/ScriptReference/RaycastHit-normal.html
    Raycast when they grab on to it and then align the player to the surface normal of the Raycast hit.
     
  34. lukasdragon

    lukasdragon

    Joined:
    Oct 23, 2014
    Posts:
    7
  35. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Because you are not defining the libraries used.

    Here is the complete script:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class TriggerParent : MonoBehaviour
    5. {
    6.     public string[] tagsToCheck;            //only check for collisions from objects with these tags
    7.  
    8.     [HideInInspector]
    9.     public bool collided, colliding;
    10.     [HideInInspector]
    11.     public GameObject hitObject;
    12.  
    13.     //see if anything entered trigger, filer by tag, store the object
    14.     void OnTriggerEnter(Collider other)
    15.     {
    16.         if (tagsToCheck.Length > 0)
    17.         {
    18.             foreach (string tag in tagsToCheck)
    19.             {
    20.                 if (other.tag == tag)
    21.                 {
    22.                     collided = true;
    23.                     hitObject = other.gameObject;
    24.                     break;
    25.                 }
    26.  
    27.             }
    28.         }
    29.  
    30.         else
    31.             return;
    32.     }
    33.  
    34.     void OnTriggerStay(Collider other)
    35.     {
    36.         if (tagsToCheck.Length > 0)
    37.         {
    38.             foreach (string tag in tagsToCheck)
    39.             {
    40.                 if (other.tag == tag)
    41.                 {
    42.                     colliding = true;
    43.                     hitObject = other.gameObject;
    44.                     break;
    45.                 }
    46.  
    47.             }
    48.         }
    49.  
    50.         else
    51.             return;
    52.     }
    53.  
    54.     void OnTriggerExit(Collider other)
    55.     {
    56.         if (tagsToCheck.Length > 0)
    57.         {
    58.             foreach (string tag in tagsToCheck)
    59.             {
    60.                 if (other.tag == tag)
    61.                 {
    62.                     colliding = false;
    63.                     hitObject = null;
    64.                     break;
    65.                 }
    66.             }
    67.         }
    68.  
    69.         else
    70.             return;
    71.     }
    72.  
    73.     void LateUpdate()
    74.     {
    75.         if (collided)
    76.         {
    77.             collided = false;
    78.             hitObject = null;
    79.         }
    80.     }
    81. }
     
  36. lukasdragon

    lukasdragon

    Joined:
    Oct 23, 2014
    Posts:
    7
    Thanks Soooo much!
     
  37. Lolko

    Lolko

    Joined:
    Oct 15, 2012
    Posts:
    5
    Hi
    I have a problem with asset. Can't download Your asset to Unity5. Show error. With Unity4.6.x everything was ok.
    Could You check this ?
     
  38. Shokupanda

    Shokupanda

    Joined:
    Jan 27, 2013
    Posts:
    7
    Hey guys. When I try to download this asset, this is what I get. (I use Unity 4.6.2f1)
    Help?
     

    Attached Files:

  39. spycarrot

    spycarrot

    Joined:
    Feb 20, 2015
    Posts:
    8
    Hey Daniel, great work! Thanks a lot for sharing this! This may be a newb question, but how do I change the input for punching from 'z' to something else?
     
  40. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
  41. kiopl

    kiopl

    Joined:
    Mar 3, 2015
    Posts:
    1
    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    3.4.2015 UNITY5 RELEASED and I download your source code in the asset store today. but this temple project can't run this template. this is error message in the console.
    ------------------------------------------------------------------------------------------------------------------------------------------------------------

    Assets/Physics Performer Kit/Physics Platformer Kit/Scripts/EnemyAI.cs(101,32): error CS1061: Type `CharacterMotor' does not contain a definition for `ManageSpeed' and no extension method `ManageSpeed' of type `CharacterMotor' could be found (are you missing a using directive or an assembly reference?)
     
  42. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Just in-case no one else has noticed, Unity 5 and the update to PhysX 3.3.0 seems to have broken the grabbing of pushables. The joint breaks immediately, so I updated the break force to Mathf.Infinity and now when you grab it, the player just slowly spins around with the object. :confused:

    Edit: Found the reason. It has to do with the players locked rigidbody rotation. If you set it to none in the GrabPushable function, they no longer rotate but get "jittery" in trying to rotate. Turning off their rigidbody interpolation (setting it to none) resolves the jitters as well.
     
    Last edited: Mar 5, 2015
  43. abatcat

    abatcat

    Joined:
    Feb 8, 2015
    Posts:
    70
    Had the same bug as Besus above. Reducing the weight of pushable objects mass to something close to 0.8 seems to fix the issue as well.
     
  44. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Has anyone tried to use this plugin as a base for a Bolt Engine multiplayer game? I'm having great trouble trying to convert the controls to work with Bolt in the "command / authoritive" Bolt way, due to the modular and fairly complex code in Physics Platformer. For example, there are 4 scripts on your player, that all interact with each other. Has anyone done this?

    Thanks!
     
  45. vincentellis

    vincentellis

    Joined:
    Oct 21, 2013
    Posts:
    100
    Is there any tutorial on how to create a reverse jump, like in mario? What about ledge grabbing?
     
  46. nonameu

    nonameu

    Joined:
    Apr 8, 2014
    Posts:
    18
    Hi Besus, first thanks for your reply.
    I'm having trouble aligning the player to the ladder. I added the raycast hit but it does nothing.
    PlayerLadderClimb.cs DanielSnd provided
    Code (CSharp):
    1.  
    2.         if(ClimbingLadder) {
    3.          
    4.             //I'll get the vertical axis (Front and back
    5.          
    6.          
    7.             float v = Input.GetAxisRaw ("Vertical");
    8.          
    9.             RaycastHit hit;
    10.          
    11.             if(Physics.Raycast(transform.position, Vector3.forward, out hit)){
    12.             transform.rotation = Quaternion.FromToRotation(Vector3.forward, hit.normal);
    13.             }
    14. ...
    15. ...
    16. ...
    am I missing something?
     
    Last edited: Mar 8, 2015
  47. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Nothing as far as I can tell, unless the FromToRotation isn't playing nicely with it. Try just setting the transform.forward to the hit.normal:
    Code (CSharp):
    1. transform.forward = hit.normal;
    You may need to use -hit.normal instead.
     
  48. nonameu

    nonameu

    Joined:
    Apr 8, 2014
    Posts:
    18
    thank you very much Besus. It work very well now.
    here's the code for others to see
    Code (CSharp):
    1. void Update () {
    2.      
    3.  
    4.         //If we're not currently climbing, we won't do anything, but if we are...
    5.      
    6.         if(ClimbingLadder) {
    7.          
    8.         //I'll get the vertical axis (Front and back
    9.          
    10.          
    11.         float v = Input.GetAxisRaw ("Vertical");
    12.          
    13.          RaycastHit hit;
    14.          if(Physics.Raycast(transform.position, transform.forward, out hit)){
    15.          transform.rotation = Quaternion.FromToRotation (transform.forward,
    16.         -hit.normal) * transform.rotation;
    17. }
    18. ...
    19. ...
     
    Last edited: Mar 13, 2015
  49. vincentellis

    vincentellis

    Joined:
    Oct 21, 2013
    Posts:
    100
    is this mobile ready?
     
  50. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Not sure if anyone noticed or not, but the higher jump height while pressed in to a corner (against 2 walls) issue is now gone in Unity 5. No need to use the kinematic rigidbody fix I posted a page or to ago if you are using this kit in Unity 5. Hate to say I told you so, but I told you that it was a Unity physics problem. :)
     
    nonameu likes this.