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
    Did you update the MoveToPoints script to look for a different tag? I believe the default tag for them was 'Waypoint'. They also need a Rigidbody (set to be kinematic) in order to actually move.
     
  2. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Has anyone successfully replaced the Box character with a different character in unity 5.2? The "Player Move" and "Throw" scripts will not accept or see the the new animation controller. The enemy does not even accept the EnemyController; not if you drag it in nor if you hit the dot button to automatically find any animation controllers.

    If someone has successfully swapped out a character, can you please do a quick written tutorial of how you did it?

    This is a great Platformer Kit, I can wait to start swapping out some art.
     
  3. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Hmm, I can only see the PlayerController as an option to load any animation controller.

    Sean
     
  4. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    The Throwing script has a reference to the animation controller as well. That is used for the arms layer for picking up, throwing, and pushing/pulling boxes. So long as the child character that you have under the Player has an animations controller, just drag it in to the animator fields for both the PlayerMove and Throwing scripts.
     
  5. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Besus....Besus....BESUS!!!!!!! your awesome!!!!!!!!! Thank you, the new character is running.

    One more question.

    How do I get the pick up control to show the pick up animation? My Arm Carry animation is separate FBX files, they are not imbedded in the character model FBX. The Arm Carry FBX is a generic animation type and the Avatar Definition(Copy from Avatar) is looking at the character model used in game.

    1. I opened up the Arm Carry animation FBX.

    2. Went to the animation tab, scrolled down to Mask, opened the drop down arrow to show the Transform.

    3. Made sure there is a check mark in the mesh and all arm bones.

    4. Then hit apply.

    5. Made sure the model was plugged into the "Throwing" script Animator field.

    But, I can not see where to plug in the Arm Carry animation so the character will raise his arms during the pick up. My Arm Carry is the same frame length as the original: 2 frames. And I can see the animation play out in the Arm Carry animation preview window. I just can not see the player raise his arms when the game is running.

    Sean
     
    Last edited: Jan 3, 2016
  6. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    Hey i have imported a custom model and i have some animations for it but how do i set the arms animation to effect my arms only. (yes i have read the document and i don't have animations in model>animations>transform). (and yes i don't make much sense. if u pm/dm me i can give you my skype and i can try explain better).
     
  7. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Hello Kamen, this question is for my kid. I think it would be better for the information to be posted in this forum, instead of a private Skype call. This way it will also help out the community in the future. This forum allows pictures to be uploaded. Can you take screen grabs of the way you got the arm carry animation to show during a pick up? Pictures always make it easy to cross a language barrier. :)
     
  8. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Are you guys adding these animations to the 'Arms' layer in the animator controller? The default layer in the Throwing script (inspector value) is 1 which would correlate to this arms layer:



    Stick your animations in to their respective slots and they will be called. If you are just moving the arms though, you will need to update your animations themselves to mask which bones you want to apply the animations to (so that the legs can still animate running while the arms follow the carry animation):

     
  9. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    yes i understand but i dont have the transform (like u do above^). so how do i just apply the animations just to my arms?
    This is mine (below)



    example.png
    example2.png
     
    Last edited: Jan 5, 2016
  10. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Then there is no animation data in your imported model (I assume that it's an fbx?).
     
  11. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    OMG....
    Don't worry i am such an idiot lol. Thank you so much :D
     
    Last edited: Jan 6, 2016
  12. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    No worries! To be fair, Unity told you the exact same thing in your animation tab. :p
     
  13. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    I do have another questions however.
    -When i try pick up an object that is quite big and is tagged "pickup", it doesn't pick up unless i jump. I get this error.

    "Can't lift object here. If nothing is above the player, perhaps you need to add a layerMask parameter to line 136 of the code in this script,the CheckSphere function, in order to make sure it isn't detecting something above the players head that is invisible
    UnityEngine.MonoBehaviour:print(Object)
    Throwing:LiftPickup(Collider) (at Assets/Physics Platformer Kit/Scripts/Throwing.cs:161)
    Throwing:OnTriggerStay(Collider) (at Assets/Physics Platformer Kit/Scripts/Throwing.cs:115)"

    A red ball spawns at whatever i am trying to pick up.
    (here is a picture):
    example1.png
     
  14. Greg Sergeant

    Greg Sergeant

    Joined:
    Feb 18, 2011
    Posts:
    76
    Hey Kamen,

    You'd need to adjust the lift position to a place where nothing is intersecting. I know thats kind of stupid that it thinks the object you're trying to lift is intersecting with where you're trying to lift it, but i added this feature last minute due to requests (before you could only lift directly above the head) and it would be somewhat tricky i guess to estimate what you're trying to lift and filter it out of the checks (though i might add in an update). For now id suggest setting the lift position above his head where there will usually be a clear area. Thanks.
     
  15. janeDoe9173

    janeDoe9173

    Joined:
    Jul 20, 2014
    Posts:
    7
    Hello everyone! Im using this SUPERB kit to make a 2.5D game and it has been a blessing! I am asking for help from the community on this. Because of my lack of coding skills I am having difficulty. I don't want my player to be able to leave the level until they have collected all 50 coins from the level. Can someone tell me how to make to where the door will not open until all coins have been collected? (as of now the player can exit whenever he/she chooses).
     
  16. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    I suggest that you read up on how to create variables and how functions like OnTriggerEnter and such work. Once you know some basics, you'll want to create a script for the door that makes a check when the player enters the trigger area. At which point you'll want to create an 'if' statement to check the current coin count (default in the GUIManager I believe) and if it is greater than or equal to the amount, open the door.
     
  17. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Kamen and Besus, thank you so much for illustrating how to show the arms raise during a pick up. My character is working, now.

    Jane Doe9173. There is a great tutorial for changing to the next scene based on the number of coins you pick up. It is in a Digital Tutors video. http://www.digitaltutors.com/tutorial/2046-Introduction-to-Unity-5

    I don't know much about scripting and it helped me out a lot.
     
  18. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Since I was starting to burn out on Crash Co., I decided to start up a new 64-bit inspired (retro) 3D platformer project using this kit as the base (naturally) since it provides such a great foundation for movement, health, and enemies. I'm only about 2 days in to it now and have most of my abilities all ready to go: http://gfycat.com/AdorableBoringHalicore

    So far the player can:
    • Double Jump
    • Attack
    • Glide
    • Wall Jump
    • "Swim" - not full-fledged swimming but more of a 'Yoshi in Mario games' type of swimming where pressing the jump button gives him a little nudge upwards (and in my case, temporarily restores some underwater movement speed).
    I did remove the throwing given a dragon with little arms really shouldn't be able to carry anything, but the attack inflicts damage (using DealDamage - just like when you touch an enemy) so you can still break them. I also had a ledge grab but like with picking things up, with those little arms it didn't look right.

    All textures have been shrunk down and had blur added to them for that true Nintendo 64 feel and as I am going in to this project with a much smaller scope than I did my first platformer (and Unity project for that matter), I hope to complete it fairly quickly. :)
     
  19. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    Looks really good. Can't wait to see the finished product!
     
  20. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Looks great Besus. How did you do the swimming and Gliding?

    Sean
     
  21. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Swimming - Just changed the jump buttons function so that when the player is in the water, a bool gets set so when the player presses the jump button, it applies a small impulse force to the player instead of the full jump force.

    Gliding - When the glide button is held down, I set the players rigidbody.y velocity to 0 and then apply a much weaker downward force (instead of the full gravity value):
    Code (CSharp):
    1. rigidbody.velocity = new Vector3(rb.velocity.x, 0f, rb.velocity.z);
    2. rigidbody.AddRelativeForce(Vector3.down * glideSpeed, ForceMode.VelocityChange);
     
  22. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Cool, thank you Besus. I'll try to do the same thing you did for the swimming and gliding.

    Sean
     
  23. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Still trying to work out the Swimming and gliding.

    Just asking....Anybody know how to create a grappling hook that the player can use to swing across with?
     
  24. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    Depends on how you want to do it, however, what you need to do is (my opinion):

    Raycast to hook point.
    Using that transform/vector3 as your center
    Use that radius to do an arch from point A to B on the circle you created to define the arch.
    start your motion along the arch from A to B.

     
  25. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    hi,
    I saw on the Asset Store the notice: "Requires Unity 5.1.3 or higher."
    which of course tells me it was somewhat updated to work with Unity 5+...
    I wanted to ask is this cool kit still actively supported, or expanded by the creator? I did not check into this thread/kit for loooooong time
    Thanks
     
  26. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    You can email the creator for great support.
    Also this forum has lots of support and if you want to know how to do anything with this kit there is lots of us that are happy to help you.

    Good Luck!!
     
  27. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    excellent thank you
     
  28. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    If anyone is good at 3D modelling, that can create me a character off my design and be able to rig it for mecanim. Please Send me a message, Thanks :D
     
  29. MichaelNielsenDev

    MichaelNielsenDev

    Joined:
    Apr 17, 2014
    Posts:
    9
    Hey, I could use some help with working around a physics bug. I noticed in the demo level that when you zipline down the rail while holding the picture-frame-shaped object, if you turn around/rotate the character while zipline-ing, you can be launched very far, sometimes with the camera unable to keep up.

    From reading through the Throwing script, I'm guessing it has to do with the bug with Unity 5's new physics no longer allowing breakForce points? Whatever the issue actually is, what would be a feasible workaround? I'd rather not have to remake the entire Throwing script, but in its current state, I can't make this into a publishable game. The bug is very easy to recreate and quite literally breaks the game. Any help is appreciated.
     
  30. nicolasbulchak

    nicolasbulchak

    Joined:
    Aug 9, 2013
    Posts:
    37
    Hey Kamen, What kind of character are you looking for?
     
  31. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    What you could do as a workaround is to prevent rotation of the player while they are not on the ground and while holding an object. You could get more elaborate and make it so that they can't rotate only while holding the frame object, but for the sake of simplicity, restricting rotation for all pickups would prevent the player from being able to do this.
     
  32. MichaelNielsenDev

    MichaelNielsenDev

    Joined:
    Apr 17, 2014
    Posts:
    9
    Thanks Besus! That's a great idea! It might affect the control of jumps, but if that becomes a problem, maybe I could just not have the held object always be oriented in the direction the player is facing.

    Out of curiosity, is there any equivalent Unity functions that could simulate breakForce? People have to be using something similar in physics-based projects.
     
  33. Kamen

    Kamen

    Joined:
    Jan 28, 2013
    Posts:
    15
    I have artwork that could help portray what i want, with an explantation would give you a clear idea of what i want. Msg me if you can help me out :D
     
  34. MichaelNielsenDev

    MichaelNielsenDev

    Joined:
    Apr 17, 2014
    Posts:
    9
    I figured out a better solution! BreakForce and breakTorque still work! You just need to increase them more than in Unity 4, it seems. The new physics engine changed the units of measurement I'm assuming, but the result is that you need a larger breakForce and breakTorque. If I'm wrong about this or am missing the actual reason why they were disabled, please let me know and disregard the following, but if I'm right...

    Re-enabling these for Pushable objects also fixes the bug where holding onto a moving pushable object (like the big blue pillar in the demo scene) and getting stuck on some geometry will have you move with the pushable even if you aren't touching it anymore. Oh, and I'm working in 5.3.0f4, so whatever wasn't working in 5.1 I guess was fixed?

    TLDR; To fix a couple bugs involving strong forces against held objects messing with your player character, simply go into Thowing.cs and change joint.breakForce to equal holdingBreakForce instead of Mathf.Infinity (same with breakTorque), and then set up the same system for Pickup tagged objects. I have my pushableBreakForce/Torque set to 1000 and my pickupBreakForce/Torque set to 700 and it seems to work great so far.
     
    Last edited: Jan 20, 2016
  35. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    Bhanshee00 likes this.
  36. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Hello, where is the code for the jump? I'm trying to make a swimming script and want to tie it into the jump button when the player is in a game object with a "water" tag.
     
  37. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    PlayerMove, in the Jump() function.
     
  38. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Thank you, Besus.

    I'm trying to attach a player to an FBX animated rope. There is an empty game object with a trigger set to the last link in the rope; this is what the player will attach to on the rope. Eventually, I would like the player to attach to the rope with a jump button press and release from the rope with the same jump button press.

    I'm using a rigidbody with force applied to the character to move the character. I am not using the character controller.

    I'm just trying to attach the player to the animated rope to start off with.

    This bit of code attaches the player to the rope, but the player eventually falls off; maybe do to speed of the rope swing movement. I don't know why he falls off.
    Code (csharp):
    1.  
    2. void OnTriggerEnter(Collider col)
    3.   {
    4.   col.transform.parent = gameObject.transform; // We will make the rope game object the parent
    5.  
    6.   }
    7.  
    8.   void OnTriggerExit(Collider col)
    9.   {
    10.   col.transform.parent = null;
    11.   }
    12.  

    This bit of code attaches the player to the rope, but when the attach happens, the player is a considerable distance away from the rope link. The player's pivot is not on top of the trigger's pivot.
    Code (csharp):
    1.  
    2. public GameObject childObject;
    3.   public GameObject parentObject;
    4.  
    5.  
    6.    
    7.   void OnTriggerEnter(Collider col)
    8.   {
    9.   if (Input.GetKey(KeyCode.P))  // this KeyCode will eventually be the same key code that makes the player jump
    10.   {
    11.   childObject.transform.parent = parentObject.transform;
    12.   //object1 is now the child of object2
    13.   }
    14.   }
    15.  
    This bit didn't even attach the player to the rope
    Code (csharp):
    1.  
    2. childObiect.transform.position = parentObject.transform.position
    3.  
    Does anyone know how to attach a player to an animated object? I appreciate any help.

    Cheers,

    Sean
     
  39. krystian75

    krystian75

    Joined:
    Aug 6, 2014
    Posts:
    7
    Hi,
    I updated kit to version 5 and now when I move player I have lags - how to fix this?
     
  40. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    For attaching a player to a rope, aren't most ropes segments of rigidbodies linked together with joints? Couldn't you just create a joint between the link the player grabs on to between it and the player? Instead of parenting, try the method used in the Throwing script to create a joint instead. You could also set the position to whatever position you wanted on the rope before creating the joint to get them situated in the right spot.
     
  41. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Hello Besus, I tried to use the Hinge and spring components in Unity. There is a bug in the 3D hinge joint that Unity has yet to address. The Spring component was way too stretchy. I don't know about setting up rigid bodies as ropes, that is why I created a joint chain in Maya, animated it as a rope and brought it into Unity as an FBX. I tried to understand the throwing script to attack to an empty game object on the rope, but couldn't get it to work...my lack of knowledge was the issue, not he the throwing code. I would like to use the throwing code. Could you help me understand how I could do this? How would I keep the player attached to the rope with this script? I thought the throw script would take the game object off the rope so he can throw it.

    It would be cool if the throw script could be used to attach the player to the rope and detach from the rope.


    I just found this tutorial showing how to hook up rigid bodies and colliders to the joints.

    Sean
     
    Last edited: Feb 2, 2016
  42. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    I assume the rope is rigged then? You should just be able to make the player a child of that particular bone of the rope model to "attach" them to it. They would then move and rotate based on just that bone of the rope.
     
  43. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    I really love this project, and I am trying to use it to make a game. But I have some problems when I try to use the enemy with waypoints prefab with an animated model.
    I change the model and animator without any problem, but once I hit play it sometimes just stays at the same place with the idle animation, sometimes goes to the Wps but still with the idle animation, and sometimes it works just fine and goes to the different Wps with the right walk animation and then it changes to idle when it stops, and attacks when it should do it.
    The player works always fine, but the enemy looks like it does not always understand if it is moving or not. And the worst is it is random for me, sometimes it works and sometimes it does not. Any clue of what should I look for it to work fine? I suspect it is something with the capsule collider, because sometimes I change it a little and suddenly it works fine.
    Thank you in advance.

    P.S.: I finally got it working. It was not a problem of colliders at all: I saw the animator's "running" state was enabled by the "Moving" parameter, and looking for it at the different scripts I found it was used in 2 of them: the "enemy AI" and the "move to points". After some trying I discobered one was negating the other, but I just comented the lines 80 and 81 at "EnemyAI" script and now everything works fine.
     
    Last edited: Feb 12, 2016
  44. dragonstar

    dragonstar

    Joined:
    Sep 27, 2010
    Posts:
    204
    ok guys i found the way to replace the GUI manager on platform Main Camera and update with UI in Unity 3d
    Screen Shoot1.jpg this is new code

    this is old one Screen Shoot02.jpg

    and how he looks
    New_UI.jpg
     
  45. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Does the Gui Manager control a virtual joystick? I think I saw a virtual joystick png in the assets.
     
  46. Besus

    Besus

    Joined:
    Mar 9, 2014
    Posts:
    226
    It does not. The GUIManager literally just draws a basic health and coin counter in the upper-left of the screen.
     
  47. dragonstar

    dragonstar

    Joined:
    Sep 27, 2010
    Posts:
    204
    that what using InControl the script I put is for replace the GuImanager and use of the current GUI not the game virtual stick or the buttons on the screen
     
  48. Lakris

    Lakris

    Joined:
    Jan 10, 2014
    Posts:
    17
    I have some questions about player/character animations

    I am creating my player in Blender.
    Which animations do i need to create(in Blender)?
    Idle, Run, Jump, Grab(arms over head).....
    I dont know how its working in Unity yet, do i need to create run+grab, run+without grab etc. or is it possible to split the animations in Unity? so all that i need is Run,Jump,Grab, Attack... ?

    Anyone know where to find tutorials on the subject, fex YouTube videos?

    Thx
     
  49. Lakris

    Lakris

    Joined:
    Jan 10, 2014
    Posts:
    17
    Or maybe i should just create+rig my character in Blender, and then create animations in Unity?

    What is the best way to do it?
    And youtube videos will still help :)
     
  50. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    Hello DragonStar, are you saying you are able to get the virtual joystick working?