1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Bawl Physics v2.0

Discussion in 'Assets and Asset Store' started by GibTreaty, Mar 4, 2011.

  1. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    [​IMG]
    Current Version - 2.01

    Bawl Physics is a fun set of abilities for a physics ball that you can use to make small marble games or larger games with grappling, boosting, wall jumping and wall magnetizing.

    You can buy this on my site if you don't want to use Unity's Asset Store.
    Download Standalone Player
    Website
    This is on the Asset Store for $10.
     
    Last edited: Mar 2, 2017
  2. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Now that this is up, I will work on making the script work in full 3D (On the X,Y and Z axis) instead of just on two axis (X and Y).
     
  3. eteeski

    eteeski

    Joined:
    Feb 2, 2010
    Posts:
    476
    Maybe it's my slow computer, but jumping only works like one fourth of the time.
     
  4. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    Seems to work fine on my slow computer :)
     
  5. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    It was even worse before when the Fixed Timestep was set to the default .02. When I set it to .01 it started acting the way it should but occasionally the jumping slips, just not as often. I don't think there's much I can do about that. I might try a lower Timestep if it lets me.
     
  6. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I added the 3D to the script. It should be updated in the Asset Store soon, not sure exactly when though. When it does, the version will be 1.1. A preview is in the Bawl Physics 3D - WebPlayer at the top.
     
    Last edited: Mar 7, 2011
  7. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Mmk the update is on the asset store so if you've already got it, redownload it... I think that's how it works! I haven't bought anything on the store yet so I'm not 100% sure.
     
  8. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I'm trying to see if I can get the controls to work a little bit better in 3D mode. Right now, if you go up a straight wall and try to go left or right, you can't. I'm also making a ball pack that I'll put on the store for free. So far I've made a couple ball types and finished them, Wooden Ball and Spike Ball.
     
  9. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
  10. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    It has been updated on the Asset Store!
     
  11. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    You can now buy this on my site if you don't want to use Unity's Asset Store!
     
  12. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I've added a PDF and a JavaScript version of the script for the player.
     
  13. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Thanks to one of the Unity users, they gave me a good idea for a feature to add to Bawl Physics. Swinging. The version that it is in is 1.6. I don't think the store has updated it yet but it should be up soon enough. The java version of the script hasn't been updated yet because I'm thinking of something I could do to split up the scripts to make things easier for me. For each ability I'll have a new script. That way I won't have to try update code that doesn't need to be updated. Finding the code I need to update between the C# and Java scripts would be a lot easier. Also, I'll probably put the java scripts in a zip file so all the script names won't have to be different. You'll just have to switch out the scripts yourself though.

    The BallControl script does a SendMessage for certain abilties so you can set up actions and effects in other scripts that are attached to the same Game Object. The ones it calls for are...

    BallControl_OnJump
    BallControl_OnDoubleJump
    BallControl_OnMagnet
    BallControl_OnSwinging (will be changed to BallControl_OnSwing)
    BallControl_OnRespawn

    A parameter is sent along with them. The variable sent is 'this' which means it's sending a handle of itself so you can access it from the function when you get the call.
    To use them you'd create a function with the same name and it will be called when that action happens. Example

    Code (csharp):
    1.  
    2. [I][B]C#[/B][/I]
    3. [B]void [/B]BallControl_OnJump([B]Ability [/B]ability) {
    4. Debug.Log("Winning");
    5. }
    6.  
    7. [B]void [/B]BallControl_OnJump([B]BallMagnet [/B]ability) {
    8. Debug.Log("Winning");
    9. }
    10.  
    11. [I][B]Java[/B][/I]
    12. [B]function [/B]BallControl_OnJump([B]Ability [/B]ability){
    13. Debug.Log("Winning");
    14. }
    15.  
    16. [B]function [/B]BallControl_OnJump([B]BallMagnet [/B]ability){
    17. Debug.Log("Winning");
    18. }
    19.  
    20.  
    Lastly, the PDF hasn't been updated to reflect the new changes either. First thing to do right now is to split up the scripts!
     
    Last edited: Jun 13, 2011
  14. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I just checked the Asset Store and it has finally updated with version 1.6. In 1.7 there's going to be a lot of changes but mostly everything will work the same. Each ability now has its own script. Any new abilities that you or anyone wants to add can be done easily. All you do is create a new script, make it inherit from the Ability class and add what you want. By inheriting from the Ability class, it gives you options for controls for that ability. You can have multiple controls per ability too. There are a few other things which I won't explain here (yet) about the Ability class that will make it easier to make your own abilities.

    The jumping has changed a little bit. You can hold down the jump button to jump whenever you hit something instead of constantly pressing the button.

    One thing I haven't figured out yet about the swinging ability is letting you drag other objects with it properly. I can make it work, but it's really hacky and spazzy.

    The java version of the script hasn't been updated and the PDF isn't updated.
    Anyways, enjoy 1.6 and I'll get 1.7 out as soon as I can!
     
  15. mikevanman

    mikevanman

    Joined:
    Sep 30, 2009
    Posts:
    108
    will this work on iphone / android, is this planned in future updates
     
  16. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I don't have an iPhone or Android so I can't test it on those. If someone has tried this on them then that'd be nice to know if they do work though. I use a Windows 7 PC and the free version of Unity3D so I'm not even sure if I'm able to test for those.

    Btw here's an update for what I'm working on. I've been messing with ConfigurableJoints to see if they would work for swinging... and they do! I'm not going to say what I did to get them to work. One problem is that if you want to be able to pull the object you're attached to, the collisions become disabled so you'll go right through that object. I won't worry too much about that at the moment though because there's an option that I've added to enable/disable pulling attached objects. If it's disabled, you'll be able to collide. But it's still better than using my hacky DistanceJoint script because with the ConfigurableJoint you can have springiness to your ropes!

    About converting my scripts to Java again, can Java use Reflection like C# can?
     
    Last edited: Jun 18, 2011
  17. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    The webplayer examples are updated with the newer swinging ability! The swinging only works for a certain distance in the example just to let you know.

    Next up I'll mess around with a little problem I've noticed with the magnet ability. Then if there's nothing else, I'll start converting stuff to Java and maybe I'll be kind enough to make a java prefab of the player too :) I have another ability in mind that I'll keep secret for now.
     
    Last edited: Jun 18, 2011
  18. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    What Am I Doing:
    Converting the scripts (not the camera scripts, only the ball scripts) to Java. I have the DoubleJump script to convert and I think I'm finished with that. I'll have to test the scripts a bit before I spit out the update.
    I thought I fixed a problem with the magnet (the ball pushes objects while you're using the magnet ability) but I didn't, I only made it worse.

    I'll be off work for a few days on Thursday and I want to work on this more during that time. That new ability I should be able to add pretty easily and it shouldn't take long. Just a small clue of what it is, it will require at least three variables, float force, LayerMask layerMask, and GameObject effect, bool raycastThroughWalls.
     
  19. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Today I've got the scripts converted and they appear to be working exactly how I want. Next step will be to change the PDF up a bit to reflect the changes. I've removed the two API files seeing as they're now useless. The new ability has been added and I'm still not going to say what it is yet until I've uploaded it.
     
  20. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    If everything goes alright and nothing is severely broken I should be able to upload the new version within the next couple of days. All I have left to do is test out the scripts and make sure everything is ok, then add some pictures to the new PDF. There's a small tutorial showing how to make a custom ability.
     
  21. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I've submitted version 1.7 to the Asset Store! Webplayer examples are updated!

    1.7 Release Notes -
    Added: Ability script and other scripts that inherit from it
    Added: Control script that is used with the Ability script(s) to define how they're controlled
    Added: JavaScript versions of all the Ability scripts,the BawlControl script and the Control script (named Control_Java)
    Added: Download link to downloaded updates the moment they come out
    Added: Two arrays in the Ability class to store effects and sounds so you can access them easier without having to create your own variables for such common things
    Added: Option to remove rope on button up

    Fixed: The FixedTimestep problem shouldn't be a problem anymore. So you can either use a fixed timestep of 0.02 or 0.01 (or anything really) and it should be fine.

    Changed: Removed the SpiralBall from the Player but it hasn't been removed from the project
    Changed: PDF is now updated to reflect the 1.7 changes and also has a Custom Ability tutorial
     
    Last edited: Jun 29, 2011
  22. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I've updated the main post's description. Thank you to all who bought, and all that buy, Bawl Physics!
     
  23. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    A couple of minor problems have been found and I'll be releasing a small update soon.

    1.7.1 -
    Fixed: Infinite double jumps when pressing the swing button and double jumping in midair
    Fixed: 3D Level Tutorial's instructions for the Magnet keys gives you the Sidescroller's Magnet keys

    Changed: The material of the Pickup is specular now and hopefully more noticable
     
  24. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    1.7.1 uploaded. Note that you can still double jump constantly in midair if you can still hit an object with the swing ability.
     
  25. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I just tried using joints to see if it would help with the magnet pushing "problem" that isn't really a "problem", just an annoyance. It only made it worse, so it looks like I'll just have to stick with the regular way.
     
  26. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    It's been awhile and I'm happy with how Bawl Physics has come along but does anyone have any suggestions or ideas that I could add to Bawl Physics?

    I've been playing with a test ability called Boost. This ability has to be charged up before it can be used. When fully charged, you let go of the button and you get boosted. The direction is boosts you in depends on the velocity you were last headed in. There are some problems with it like not being boosted when you let go of the button, probably a physics timing problem inside FixedUpdate.

    For the ability I have the effect and sound set as the same thing as the double jump's effect and sound but I'm hoping to find a way to make the ball glow as it charges up. I might be able to do that by duplicating the ball and applying a glow shader/material to it.
     
  27. twitchfactor

    twitchfactor

    Joined:
    Mar 8, 2009
    Posts:
    327
    I think if you're going to do a boost, the easiest way is like Sonic. Of course, since he stops in his tracks to build up, it might take away from someone who wants to do a "boost/burst" while running type game.
     
  28. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Sonic is the game I got the boost idea from! Although I haven't added in a way to stop the ball from moving during a charge, I don't think it would be impossible to do. I'll play with it and see if I can make it work.
     
  29. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I've got an "ok" sonic-like boosting done but it's not perfect. There's the option to use the angular velocity as the direction, which works great. While charging, it applies drag using the opposite of your velocity multiplied by a drag variable to keep you still. It also changes your friction to 0 and sets it back to normal after you boost. I'll post a seperate web player example for it sometime today.
     
  30. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
  31. onllm

    onllm

    Joined:
    Mar 4, 2011
    Posts:
    111
    1 question, can i use it on a 2d object? specifically something created using the RageSpline plugin.(basically a collider than only goes on x and y).
     
  32. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Yea it should work as long as you're using a rigidbody along with it. Also, the rotation in the sidescrolling example uses the Z axis to roll on so keep that in mind.

    EDIT!
    Z axis is the Roll axis that I'm talking about. The two axis that you actually see it moving on ARE the X and Y axis.
     
    Last edited: Jul 29, 2011
  33. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    My Plans for 1.8:
    1. Convert Boost ability to Java
    2. High poly player model (same theme)
    3. 2 proper levels with buttons and things.
     
    Last edited: Aug 2, 2011
  34. twitchfactor

    twitchfactor

    Joined:
    Mar 8, 2009
    Posts:
    327
    GIB3D: Do you have a side-view 2.5D webplayer with the new boost in it?

    Also, any idea how long it'll take for 1.8 (the boost in JS primarily)?
     
  35. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I haven't tested the boost for sidescrolling so there's no example for it yet, but it should work. I'll probably send out another 1.7.x update with the boost in it. Converting to java only takes a few minutes. Then I have to test it to make sure everything in it works alright.
     
  36. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
  37. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    The update for Bawl Physics has been submitted to the Asset Store and will be updated on the instant-download link soon.

    1.7.2 -
    Added: BawlBoost ability in C# and JavaScript

    Fixed: OnControl function being called multiple times while holding a control
     
  38. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Something buggy is happening with the boost script and I'm not entirely sure why. If you boost, sometimes you go the wrong direction or sometimes you don't get boosted at all. Also, I've changed a couple things in the JavaScript version of the boost script so I'll resubmit it as 1.7.2.1.

    Edit:
    Wow, just found out why. It's my own dumb fault. The script is working how it's supposed to. I have an Enum for limiting which axis you can boost on (Negative, Positive, Both, Disable) and I had the X and Z set to only the Positive axis. The Y axis was just blank for some odd reason. I set the X and Z to use "Both" and it works as intended. Anyways, the only problem was with the PlayerObject3D prefab so that'll be fixed with the resubmission.
     
    Last edited: Aug 6, 2011
  39. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I've been playing around with my own Minecraft-like terrain engine and I've put Bawl Physics into it to see what it's like. Try it out here Bawl Physics - Terrain Engine
    Note: There's no proper lighting so it will look pretty dang ugly.
     
  40. twitchfactor

    twitchfactor

    Joined:
    Mar 8, 2009
    Posts:
    327
    Umm...

    Cool? ;)
     
  41. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Thanks?
    I have to figure out how to get some good lighting in it and some slanted terrain so the ball can roll across it without you having to jump over every block. Hopefully I'll be able to use this to make a level for Bawl Physics when I'm done.
     
  42. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I have received an email telling me that the link in the PDF to download Bawl Physics isn't working so I'll have to fix that. For a temporary fix, in the link change the # to ? and take off the ,1 at the end.
     
  43. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I've fixed that and added a couple things. I figured that it might be smart to let people download a whole project folder so they don't have to set up everything like Inputs and Layers before they can play it properly. I'll rebuild the Web Players to show off the new player model.

    1.7.3 -
    Fixed: Download link in PDF was wrong
    Changed: Player model
    Added: Includes a zip file containing the full project folder <- On MediaFire

    Edit:
    Web Players updated!
     
    Last edited: Nov 22, 2011
  44. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Update!
    1.7.4 -
    Added: LockMouse.cs
    Fixed: Timer on the BawlExplode scripts were going down to 0 in 1 second regardless of the amount of time you set
    Fixed: BawlMagnet ability bug when magnetizing to a collider that gets deleted/disabled*
    Fixed: BawlSwing rope not disappearing if the connected object gets deleted or collider gets disabled*
    Added: BawlExplode script now sends the message BawlExplode_OnExplode with a Collider array parameter
    Changed: BawlRoll3D script now works in 2D and has been changed to BawlRoll
    Changed: The timer variable in BawlExplode is now public
    Removed: BawlRoll2D scripts
    Removed: All JavaScript Abilities and Prefabs for Bawl Physics have been removed (they can be downloaded through the link in the PDF, they will not be updated beyond version 1.7.3)

    *This is still a problem if changing the mesh manually/procedurally
    -Abilities can be enabled and disabled using
    SendMessage(“AbilityName_UseAbility”)
    SendMessage(“AbilityName_StopAbility”)
    (some abilities require a parameter)
    (some abilities don't have a StopAbility function)
     
  45. jerico2k

    jerico2k

    Joined:
    Mar 31, 2012
    Posts:
    2
    Awesome bawl package, this was really worth the money. I do think I have found a bug. When using the swing ability on a rigidbody object(w/ draggable enabled) the ball will pass directly through the object. I realize that you are basically creating a joint on the rigidbody and setting the ball as the connected body. You also had an ignore physics set to false between the two objects but it doesn't help. I adding that in an update loop on a separate script to try and fix the problem but no such luck.
     
  46. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Yea the draggable option is a bit buggy, not sure if it's even possible to do it correctly. I left it in to play around with mostly.
     
  47. nab477

    nab477

    Joined:
    Jun 14, 2011
    Posts:
    46
    I noticed that the comments on the beginning about the keyboard sometimes working sometimes don't still exist on the demo,

    to fix that, simply use the Update method for the input handling maybe set a flag (isUpPressed = true;) then use that in the FixedUpdate method reset it to false (or simply handle the input in the Update function).

    unfortunately, I don't have a project where I can use this package for the time being, unless it can be used with the mobile devices for something similar to labyrinth games.
     
  48. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    Well that's odd, I thought I fixed the control problem. All the controls are updated using the Update function so it should be fine. Maybe I forgot to update the WebPlayer demo. I'll check it out as soon as I can.

    About using it on mobile devices, HeadHunter from these forums has got it working on his Android phone. Since I don't have one though, I can't actually test it myself and therefore can't code specifically for it. He edited the rolling code to make it work with the phone, I'm not sure what he did though.
     
  49. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    766
    I'm going to be working on an update for Bawl Physics 2.0. The scripts are going to be reworked and recoded to function with Unity 4.5 (at least). Besides the scripts, I want to work on an entirely new level to show off the features of this package. Here's what I've changed so far...

    Controls
    for each ability have been stripped from each individual ability's script. It was a terrible idea to put them in there like that anyways. Instead I've put the controls into a single script. Each abilities' state can be changed using "Ability.StartAbility()", "Ability.StopAbility()" and "Ability.UsingAbility()". This should make it a bit easier to code for special inputs that aren't included in the Controls script that I have made such as Touch input.

    The Jump and the script that allows for multiple jumps have been consolidated into a single MultiJump script. It allows you to choose how many jumps that the ball is allowed to make whilst in the air. You can also tell it whether or not it should count it as a jump if you have exited collisions and haven't jumped at all. This is useful for when you've rolled off the side of a platform and don't want the player to double jump anymore, only allow for a single jump.

    The Magnet Ball
    script has been redone. It'll now use a joint to gravitate it towards static walls/object and dynamic objects rather than AddForce. It will also have a layer mask that you can set so the ball will only magnetize to certain surfaces. If it rolls to the sides of the magnetizable surface while it's currently on it already, it will try to stay on until you give enough force to get off.

    That is all for now!
     
  50. twitchfactor

    twitchfactor

    Joined:
    Mar 8, 2009
    Posts:
    327
    Great to see you're still supporting this. One day, I'll get around to making my great Marble Madness homage with this package. :D
     
    GibTreaty likes this.