Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bowling Starter Kit

Discussion in 'Assets and Asset Store' started by Aiursrage2k, May 25, 2014.

  1. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835

    Attached Files:

    Last edited: Jul 4, 2014
  2. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Looks like a really good starting point.

    Stuff I would want
    *Ability to curve the ball
    *Online
    *AI opponent
    *Power Meter
    *Bumpers :)
     
  3. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Yeah I wasnt sure if people wanted multiplayer because it would require photon, but i guess I will add it. Not sure what you mean by bumpers. And by ability to curve ball do you mean in game while its rolling?
     
    Last edited: May 25, 2014
  4. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Yeah the curve thing is probably the most important thing for me. I was thinking of like a button that could tell you the angle of the curve of the ball while it's rolling down the lane. The bumpers are just like a bar that keeps the ball from going into the gutters, mostly there for kids so they don't gutter ball.

    *Also while I'm thinking about it could we have the ability to pick where to start the bowling ball at. Like you could pick the middle or right by the edge of the gutter.

    *Also a sound for the ball and a sound for the pins would be great.

    *Finally the pin physics seem a little off. Seems to me they are going to fast. Could you make it like an exponential explosion, where it starts off a little slower than picks up the speed on the demo.
    *On second thought maybe the pin physics are closer than i think, could you possibly put the pins in a box like in real life to see how they act when they can't go flying.
     
    Last edited: May 25, 2014
  5. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    I have some ideas about how I would like a bowling ball game to be. Could you tell me if any of this is possible.

    $bowling ball diagram.png
     
  6. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Okay see if that is any better.

    You can choose which angle the ball is by holding down the left mouse button and using mouse x. You can set the balls position by selecting dragging it to the left and right, and you can flick the ball by starting on the ball and flicking it.
    http://inanegames.ca/bowlarama/bowlarama.html
     
  7. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    So much better! I like everything about it, so so much better. :)

    The one thing I see now is perhaps the pins. They seem too light and makes it kind of easy to get strikes. Maybe make them "heavier", because sometimes I accidentally throw it really softly and still get a strike.

    Edit
    The other thing I just noticed is with the curve system. You can setup the curve, but when you move the ball to the edge it loses the curve. That made it difficult to get the curve in the right spot.

    But other than that, it's truly really great and hopefully mobile ready. Can't wait to buy. :)
     
    Last edited: Jun 8, 2014
  8. jmjd

    jmjd

    Joined:
    Nov 14, 2012
    Posts:
    48
    As Shigidy has said, it's pretty easy to get strikes. Also, you've got a small bug in the scoring code (see 10th frame in the screen shot.)

    upload_2014-6-8_1-50-11.png

    But you've got a nice asset here. Personally, I'm more interested in the bowling art assets then the starter kit/game as a whole. I've wanted to make a game for my son, an idea that uses bowling pins and bowling balls, but the only bowling asset collection on the store that I've found is, unfortunately, too expensive for this small project.

    I don't know what price range you have planned for the starter kit, if it's not too pricey, than I'll probably buy it just for the assets. Or, maybe you could consider releasing a pack that is just art, no game or scripts.
     
  9. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I dont know what you consider too pricey, but the basic kit will be available for $25. Just providing the art assets, ball and pins, i dont think it would even be worth paying someone to make the asset store key images, you can pick up some cheap bowling stuff from turbosquid.
    http://www.turbosquid.com/3d-model/sports/bowling

    The kit isnt done, right now i made the pins really fat, really light, I made the ball balls x-force really low so yeah right now its super easy to get a strike. I will fix the scoring bug, etc and the GUI is still only temporary, its a WIP right now, not done yet, we are going to add a bowling alley -- it wont be outside in the ocean.

    So I am going to have 2 versions. The regular version - lite version for say $25. Then the pro-version with 2 player photon multiplayer, extra skins for balls, and pins, AI opponent -- with varying 3 difficulties (easy, medium and hard) for $35. I could sell an art only pack as well for like $20, but I think the asset store doesnt like that much duplication, I will be lucky if I can add the pro and lite versions.
     
    Last edited: Jun 8, 2014
  10. ctknoxville

    ctknoxville

    Joined:
    Oct 1, 2013
    Posts:
    32
    $35 seems like a great bargain if you can do multiplayer, AI, etc. Will pick up as soon as available.
     
  11. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Yeah I can do photon networking. But youll need to get the PUN for it, if you want to make it mobile (or have unity pro). Thats why I will have 2 versions this time.
     
  12. jmjd

    jmjd

    Joined:
    Nov 14, 2012
    Posts:
    48
    Thanks for the turbosquid link. I guess I probably should have looked at other 3D model and art websites.

    And your prices for the two versions of your pack seem like really good deals.
     
  13. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
  14. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Just played it. Amazing, again can't wait to buy. :)

    Edit:

    I did get a small error. On the tenth frame I got a 9 and then got the spare. It didn't give me the free extra roll. And maybe there could be a quick animation of the pin slider thing cleaning up the pins. And the pin organizer thing picking up the pins. To add more authenticity. Other than that it was awesome.

    Finally, how easy will it be to port to mobile and android?
     
    Last edited: Jun 10, 2014
  15. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
  16. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Just played and everything is GREAT. There is even different levels of ai easy, medium and hard. The only thing I didn't understand what "rank" did when I changed it.

    The only little thing that would be good is maybe have a mph to show how fast you threw ball maybe.
    I do have a major request too. Just things I would love to see.

    Curve

    I like the arrow and everything and the power they are great. But I was wondering if you could, could you make a button for spin that would change the straight arrow to like a curve arrow. And be able to hit the button again to make it straight again.

    The Curve would be something like this



    I played another bowling game and they use the accelerometer for the curve. Didn't know what you thought about that idea.

    Level Up
    Another good thing would be some sort of leveling up system. This could be used for your future game kits as well. :) Could be great for unlocks like cool bowling alleys and bowling balls. For every pin you knock down you get 5 exp or something.

    Sound
    Something I also was thinking about was the pins. Is there anyway could possibly make each pin have it's own sound. It seemed like to me there was just one sound for the whole set. One time there was only one pin and when I hit it is sounded like a full strike. Wondering if that was just me playing tricks on myself or what you thought about that.

    Bowling Ball

    The bowling ball starting height was another thing I had in mind. Is there anyway it could be set off the ground some so you hear that pop of when it goes down the lane. Right now as you know it's on the ground at the beginning.

    Local Multi-player

    Wondering if you could have another option at the menu screen, for local multi-player.

    Pin Catcher

    I was wondering if you could add that animation in if you had time. It's the thing that picks up the pin and the other thing then slides all the knocked pins away, then resets the other pins. Instead of looking at nothing for say gutter ball it could also be moving the pins too. :)

    Pins

    I still think they are too easy to knock down. I still think they should be heavier. I did some research and google said pins are, "Pins are 4.75 inches wide at their widest point and 15 inches (380 mm) tall. They weigh 3 lb, 6 oz, although as of 1998 pins weighing up to 3 lb 10 oz (1.6 kg) are approved". I understand this is probably the hardest thing to get right or maybe I'm being overly critical here, I don't know. :)

    Edit: I think I just figured out about the pins. It seems there to easy to knock each other over. For example:
    I hit some pins, and those pins were falling over slowly which is just fine. But then they slowly hit the other pins. They were falling so slowly they shouldn't have knocked down the other pins, but they did. This is what I'm seeing that's messing up the simulation feel. The bowling ball interacts fine with the pins i think. It's the pin to pin action.

    I got going pretty good, but I can't think of anything else at the moment. But like I said earlier this package is already great and can't wait to see more. :)
     
    Last edited: Jun 14, 2014
  17. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    ->Sound: yeah good point
    ->Pin catcher: we are going to add the pin catcher
    ->Pins: I tried making sure the ball always went a certain speed, but that means its always going to knock the pins easily. There could be a timeout if you threw the ball to slowly
     
    Last edited: Jun 14, 2014
  18. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    I was wondering if you could make some accelerometer type of throw. Similar to this. So instead of the arrow, it could possibly be the accelerometer. What do you think?

     
  19. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Ill need to play it to see what they are doing, but it seems like they are just applying a force each frame depending on the tilt of the device. I am not sure i like that, where your turning your device like that in a bowling game -- because you are not really being passive -- your more active -- and bowling is more a passive game IMHO.
     
    Last edited: Jun 15, 2014
  20. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
  21. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Maybe if i was selling a complete game but that would be more expensive and they really dont sell that well. The bowling kit will be pretty niche item anyway so I have to draw the line somewhere.

    Okay let me ask a question then how much would you be willing to pay for a complete bowling kit.
    http://www.easypolls.net/poll.html?p=53a0db73e4b0d5f2a7af499b
     
    Last edited: Jun 18, 2014
  22. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    I understand completely :) I hope it sells very well, but at the moment I'm strapped for cash. So the limit for me would have to be 150.

    So I'll stop asking for like extra stuff.

    Saw another app Online Bowl 3D
    https://play.google.com/store/apps/details?id=ru.igsoft.bowlingonline3d
    Wondering what you thought about it.

    These are things I would still love.
    • The ball seems like it can go way too fast. Could you put a limit on the force of the ball or something. Sometimes it can get there in like one second. When I feel it should take between 3 and 4 seconds. I timed the professionals and they consistently threw between 2.09 and 2.44 seconds. I feel like that should be max power and on average you should get between 3 and 4 seconds.
    • I also would like to see the ball glide for like half of the lane then really begin to start rolling in whatever direction you sent it. What you would see if a pro bowler threw it.
    • When the ball goes in the gutter it seems like it snaps too it. Can that be a smoother transition.
    • Also, wanted to see if you could get the camera to follow the ball more closely. Would really love a closer feel.
    • With online play could you have a timer of like "30 seconds" to throw the ball.
    • How hard would it be for me to put in accelerometer for the ball later on? Because I would really love that myself if the throwing motion couldn't change.
    What do you think of a different throwing style.

    The only reason I'm talking about different throwing styles is because of the arrow seems like it's almost not needed, am I right. Because you can flick using the mouse or touching the screen so honestly you don't need the arrow. I know I'm the one who said hey this would be a good idea, but now I see it, it's kind of like having the same thing twice. What do you think of the ball delivery of "Online Bowl 3D"? And if you like this throwing motion could you have two throwing styles that could be changed in the menu. One flick with curve and one flick and draw? That would be amazing. I realize this is alot.

    Finally, when do you think it'll be on the asset store. :)

    Edit:

    With the balls could there be an easy way to tweak the settings of the ball. Like have one with more power. One with more speed. And one with more control. With a way to change to have everything in between.
     
    Last edited: Jun 18, 2014
  23. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Okay added the pin setter, and sweeper. I added the ability to configure single player, so you can now choose to play against no one, a second local human player or a second ai player. I also added an alley select -- where you can choose which alley to play. We also have 3 colored pins now.
    http://inanegames.ca/bowlarama/bowlarama.html

    I will work on the multiplayer some more tomorrow. I still need to change over the UI and waiting on that.
     
  24. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    This is good. Really looking good.

    Quick fixes
    • The thing I noticed right off the bat was that there is no sound of the ball hitting the gutter when you gutter ball. Hoping you could add that.
    • Seems like the pin setter and sweeper do their jobs too quickly. Could you slow down there animations. Could you slow it down by like one second for each one.
    Other Fix (Physics)
    • Now it seems like the ball can get stuck on the pins and not fall to the back. I don't know if this will help, but wondering you thought. https://answers.yahoo.com/question/index?qid=20090312123446AAQv3Uh
    • Here is a easier example.
    • Example: A bowling ball has a mass of 12 kg and it is accelerating at a rate of 2.5 m/s2. Calculate the force with which it hits the pins.
    • Example Answer: Force = mass*acceleration
    • = 12*2.5
      = 30N
    Some other stuff I just thought of.
    For the bowling lane. This will make the ball slide then roll quickly I'm thinking.
    • Add a physics material for the actual lane. Because on a real bowling alley they have about 40 ft. of oil on the fist part of the lane (Actually it's 32ft and then buffed for another 8 ft). Then the rest is just normal. Wondering if you if you could split the lane for the first 40 ft as one material and make it slick and one for the rest of what is already there i guess. It's called something like "house"pattern. http://bowling.about.com/od/oilpatterns/p/house_oil_pattern.htm
     

    Attached Files:

    Last edited: Jun 19, 2014
  25. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    I found this in another forum post and wondered if it might apply to this project. There's was a pool or billiard template.

    One serious bug about your template as I remember:
    - Ball spin logic is wrong. You are using force at position function of Unity. Don't use it because it does something else not suitable for billiard balls. Instead use AddTorque() , calculating correct torque direction and amount is up to you.

    I wonder what you think.
     
  26. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    ->Added the shot clock to multiplayer

    ->Thats simply because I changed the way it works so that its not always moving at top a speed, so when the ball hits the pins it will actually slow down (so it shouldnt always knock it over). I made the "out of bounds" closer to the pins now, and gave the pins less friction.

    ->I slowed down the sweep and pin setter by half.


    http://inanegames.ca/bowlarama/bowlarama.html
     
  27. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Cool I like the updates!

    Stuff I saw wrong.

    • Sometimes with the bowling ball it just kind of stays at the edge of the gutter when it should have went in the gutter.

    I was wondering what you thought of the bowling ball physics.

    I found an interesting video wondering what you thought.




    The picture at the bottom is like an explanation of how most bowling alleys are. They oil the first part of the lane and then it fades off.

    Also this video was interesting about torque

     

    Attached Files:

  28. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    It's been about a week, wondering about any new updates and when it might be available on the asset store. :)

    I just played it again. It seems like the pins still have too much friction. They don't slide enough I don't think. Seems like no matter how hard I throw either there's no explosion of the pins. Wondering if maybe now they are a bit too heavy.

    So I think they might be too heavy and too much friction, because they don't slide or bounce around much. :)
     
    Last edited: Jun 27, 2014
  29. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I guess it will be in there around 3-4 days just waiting for hte asset store to review it.
     
  30. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Waiting to buy. I have a couple of question before I buy.

    -I'm trying to set up the lane in three different sections. First 32 ft. really slick. Next 8 ft. mixed. Last ft. to the pin completely un-slcik. Could you help me up with setting up the 3 different physics material.
    -Camera to the ball to follow it all the way to the pins.
    -Accelerometer that could move the ball down the alley.

    Would you be willing to help me on these three ideas.
     
  31. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    ->You can set how far the camera follows the balls.
    Look at the changeMat.png specifically the max z value

    ->To make it slick you could have a trigger box and when the ball enters that you could simply change the balls physicx material. All you would do is set each trigger boxes position and set the material you want, you would make it low fruition for the slick and higher for the other one.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ChangePhysicsXMat : MonoBehaviour {
    5.     public PhysicMaterial mat;
    6.     public Color gizmoColor = new Color(1,0,0,0.5f);
    7.  
    8.     void OnDrawGizmos() {
    9.         // Draw a yellow sphere at the transform's position
    10.         Gizmos.color = gizmoColor;
    11.         Gizmos.DrawCube (transform.position, transform.localScale);
    12.     }
    13.  
    14.     void OnTriggerEnter(Collider col)
    15.     {
    16.         if(col.name.Contains("Ball"))
    17.         {
    18.             col.material = mat;
    19.         }
    20.     }
    21. }
    22.  
    ->For the accelerator just add this to the Ball script. If you want it, the larger you make the curve scalar the more it will curve.
    Code (CSharp):
    1.        public float curveScalar = 2100f;
    2. public void FixedUpdate()
    3. {
    4.  
    5. if (m_fired)
    6. {
    7. floatcx = Input.GetAxis("Horizontal");
    8. if(Application.platform==RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
    9. {
    10. cx = Input.acceleration.x;
    11. }
    12. floataccel = cx * curveScalar;
    13. m_rigidBody.AddForce(newVector3(cx,0,0));
    14. }
    15. }
     

    Attached Files:

    Last edited: Jul 4, 2014
  32. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Thank you, you so so much. I've just bought it. Can't wait to see if I can get it to work. Thanks again! :)
     
    Last edited: Jul 4, 2014
  33. MESBill

    MESBill

    Joined:
    Sep 16, 2012
    Posts:
    13
    Looks like the kit was made with multiplayer in... please advice on how to go about removing the photon stuff as commenting off certain scripts brings out other issues elsewhere.

    I'm looking at making a simple single player version for mobile.

    Thank you.
     
  34. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Send me invoice ID in a pm I'll verify it and then send you a link to one that doesn't have multiplayer.
     
  35. MESBill

    MESBill

    Joined:
    Sep 16, 2012
    Posts:
    13
    Thanks... dropped your a message...
     
  36. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Can you help me setup the bowling kit up some.

    I've downloaded and imported both, itween and photon +.
    Done the build settings with menu, outside, inside.

    But now I'm stuck on what's next.

    IndexOutOfRangeException: Array index is out of range.
    BowlingKit.MainMenuState.updateGraphicsQuality () (at Assets/BowlingStarterKit/Scripts/MenuStates/MainMenuState.cs:235)
    BowlingKit.MainMenuState.Start () (at Assets/BowlingStarterKit/Scripts/MenuStates/MainMenuState.cs:27)

    I'm getting this error. Could you help?
     
  37. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    I got some help and he helped me out. Line 235 could be changed to this. If nothing else works for you.

    graphicsQuality
    .setTexture(graphicsTexture[0];
     
  38. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    So I'm trying to add the accelerometer to the ball script first because I thought that would be easiest of the three. But I'm getting two errors.

    Assets/BowlingStarterKit/Scripts/GameScripts/Ball.cs(7,21): error CS0116: A namespace can only contain types and namespace declarations

    Assets/BowlingStarterKit/Scripts/GameScripts/Ball.cs(6,22): error CS0116: A namespace can only contain types and namespace declarations


    I pasted the code on line 6. I have a picture attached to show what I did. I know it's just a copy and paste error, but what line can I safely paste it?
     

    Attached Files:

    Last edited: Jul 15, 2014
  39. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    Okay I got a little bit further with the code... but got this error.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. namespace BowlingKit
    4. {
    5.  
    6.     //this is our simlpy ball class
    7.     //ideally we would want to run the simulation on its own client, so whenever the player fired the ball we would simply run it on the master.
    8.     public class Ball : MonoBehaviour
    9.     {
    10.         //a reference to the balls rigidbody
    11.         private Rigidbody m_rigidBody;
    12.  
    13.         //a reference to the balls inital position.
    14.         private Vector3 m_initalPos;
    15.  
    16.         public Vector3 angVel = new Vector3(0,5,0);
    17.  
    18.         //the minimum and maximum gutter positions.
    19.         public Vector2 gutterPositions = new Vector2(-0.65f,0.65f);
    20.  
    21.         //has the ball been fired.
    22.         private bool m_fired=false;
    23.  
    24.         //the inital rotation
    25.         private Quaternion m_initalRot;
    26.  
    27.         //the pointer gameobject, lets hide it when the ball is fired and show it when we reset the ball
    28.         public GameObject pointerGO;
    29.  
    30.         //the force mode we want to use when "firing the ball".
    31.         public ForceMode forceMode;
    32.  
    33.         Vector3 screenPoint;
    34.         Vector3 offset;
    35.         public float dragThreshold = 20;
    36.         private bool m_mouseDown = false;
    37.         private Vector3 m_prevLoc;
    38.         private PhotonView m_view;
    39.         void Start ()
    40.         {
    41.             m_rigidBody = gameObject.GetComponent<Rigidbody>();
    42.             m_initalPos = transform.position;
    43.             m_initalRot = transform.rotation;
    44.             m_view = gameObject.GetComponent<PhotonView>();
    45.             if(pointerGO)
    46.                 pointerGO.SetActive(true);
    47.         }
    48.         public void OnDisable()
    49.         {
    50.             BaseGameManager.onBallHitBowlingPit -= onBallHitBowlingPit;
    51.         }
    52.      
    53.         public void OnEnable()
    54.         {
    55.             BaseGameManager.onBallHitBowlingPit += onBallHitBowlingPit;
    56.         }
    57.  
    58.         public float curveScalar = 2100f;
    59.         public float floatcx;
    60.         public float cx;
    61.         public void FixedUpdate()
    62.         {
    63.          
    64.             if (m_fired)
    65.             {
    66.                 floatcx = Input.GetAxis("Horizontal");
    67.                 if(Application.platform==RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
    68.                 {
    69.                     cx = Input.acceleration.x;
    70.                 }
    71.             floataccel = cx * curveScalar;
    72.                 m_rigidBody.AddForce(new Vector3(cx,0,0));
    73.             }
    74.         }
    75.      
    76.      
    77.         //we have landed in the gutter
    78.         void handleGutter()
    79.         {
    80.             //lets zero out the angular velocity
    81.             m_rigidBody.angularVelocity=Vector3.zero;
    82.          
    83.             //we only care about the z-component of the velocity, zero everything else out -- so it moves along the z-axis.
    84.             Vector3 vel = m_rigidBody.velocity;
    85.             vel.y=0;
    86.             vel.x = 0;
    87.             m_rigidBody.velocity=vel;
    88.  
    89.  
    90.         }
    91.         private float m_gutterTime = 0;
    92.         private bool m_moveToGutterCenter = false;
    93.         public float gutterTimeToCenter = 0.3f;
    94.         private float m_startGutterXPos;
    95.  
    96.         public Vector3 curveForce = new Vector3(0,0,3.8f);
    97.         void Update () {
    98.  
    99.             if(m_moveToGutterCenter)
    100.             {
    101.                 m_gutterTime+=Time.deltaTime;
    102.                 float val = m_gutterTime / gutterTimeToCenter;
    103.  
    104.                 if(val<=1)
    105.                 {
    106.                     Vector3 vec = transform.position;
    107.                     vec.x = Mathf.Lerp(m_startGutterXPos,m_gutterPos,m_gutterTime);
    108.                     transform.position =vec;
    109.                 }else{
    110.                     m_moveToGutterCenter=false;
    111.                 }
    112.             }
    113.             if (m_fired)
    114.             {
    115.                 //m_rigidBody.AddForce(curveForce);
    116.  
    117.             //    transform.Rotate(angVel,Space.World);
    118.                 //m_rigidBody.angularVelocity = angVel;
    119.             }
    120.         }
    121.         public void onBallHitBowlingPit(string id)
    122.         {
    123.             if(id.Contains("Pit")){
    124.                 if(audio)
    125.                 {
    126.                     audio.Stop();
    127.                 }
    128.             }
    129.         }
    130.  
    131.         //reset the balls position.
    132.         public void reset()
    133.         {
    134.             if(m_fired)
    135.             {
    136.                 m_fired=false;
    137.                 if(pointerGO)
    138.                     pointerGO.SetActive(true);
    139.  
    140.                 transform.rotation = m_initalRot;
    141.                 if(m_rigidBody){
    142.                     m_rigidBody.isKinematic=false;
    143.  
    144.                     m_rigidBody.angularVelocity=Vector3.zero;
    145.                     m_rigidBody.velocity=Vector3.zero;
    146.                     m_rigidBody.isKinematic=true;
    147.                 }
    148.                 transform.position = m_initalPos;
    149.             }
    150.         }
    151.  
    152.         //fire the ball
    153.         public void fireBall(Vector3 vec)
    154.         {
    155. //            Debug.Log ("fireBall");
    156.             if(m_view)
    157.             {
    158. //                Debug.Log ("fireBall2");
    159.                 m_view.RPC ("fireBallRPC",PhotonTargets.All,vec);
    160.             }else{
    161.                 _fireBall(vec);
    162.             }
    163.         }
    164.  
    165.         //lets fire the ball foreveryone!
    166.         [RPC]
    167.         public void fireBallRPC(Vector3 vec)
    168.         {
    169. //            Debug.Log ("fireBall3a");
    170.             _fireBall(vec);
    171.         }
    172.         void _fireBall(Vector3 vec)
    173.         {
    174.             //make sure we have a rigidbody and that the time is not paused
    175.             if(m_rigidBody && Time.timeScale!=0)
    176.             {
    177. //                Debug.Log ("fireBall3");
    178.  
    179.                 //play the ball audio clip
    180.                 if(audio)
    181.                 {
    182.                     audio.Play();
    183.                 }
    184.  
    185.                 //call the fire ball function
    186.                 BaseGameManager.fireBall();
    187.  
    188.                 //hide the pointer
    189.                 if(pointerGO)
    190.                     pointerGO.SetActive(false);
    191.  
    192.                 //we have fired the ball
    193.                 m_fired=true;
    194.                 m_rigidBody.isKinematic=false;
    195.                 //add a force
    196.                 m_rigidBody.AddForce(transform.rotation * vec,forceMode);
    197.                 m_rigidBody.AddTorque (angVel);
    198.                 //give the ball some angular velocity.
    199.             //    m_rigidBody.angularVelocity = angVel;
    200.  
    201.             }
    202.         }
    203.  
    204.  
    205.         //the mouse is down lets get the screen point and offset
    206.         void OnMouseDown()
    207.         {
    208.             if(m_fired==false)
    209.             {
    210.                 m_mouseDown=true;
    211.                 m_prevLoc = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
    212.  
    213.                 screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
    214.  
    215.                 //m_prevLoc = screenPoint;
    216.                 offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
    217.             }
    218.          
    219.         }
    220.         void OnMouseUp()
    221.         {
    222.             m_mouseDown=false;
    223.         }
    224.  
    225.         //your dragging the ball around
    226.         void OnMouseDrag()
    227.         {
    228.             if(m_fired==false && m_mouseDown)
    229.             {
    230.                 Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
    231.                 float d1 = Mathf.Abs(m_prevLoc.y - curScreenPoint.y);
    232.  
    233.                 //look dead ahead
    234.                 //transform.LookAt( new Vector3(transform.position.x,transform.position.y,18));
    235.  
    236.                 //if our input is less then the drag threshold then we will move the balls position to that world position along the x-axis
    237.                 //this should sync up with the value "comfortZone" in the flickscript. If its less then this value its a drag, if its bigger its a flick.
    238.                 if(d1 < dragThreshold)
    239.                 {
    240.                     Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
    241.                     curPosition.z = transform.position.z;
    242.                     curPosition.y = transform.position.y;
    243.                     transform.position = curPosition;
    244.                 }
    245.             }
    246.         }
    247.  
    248.  
    249.         //we landed in the gutter, its looking to ensure that the gutter actually has a tag called "Gutter".
    250.         public void OnCollisionStay(Collision col)
    251.         {
    252.             if(col.gameObject.tag.Equals("Gutter"))
    253.             {
    254.                 handleGutter();              
    255.             }
    256.         }
    257.         private float m_gutterPos = 0;
    258.         //we entered into a collision with the gutter
    259.         public void OnCollisionEnter(Collision col)
    260.         {
    261.             if(col.gameObject.tag.Equals("Gutter"))
    262.             {
    263.                 //lets call the gutter ball function
    264.                 BaseGameManager.gutterBall ();
    265.  
    266.                 //rigidbody.collider.enabled=false;
    267.                 //lets zero out the angular velocity, and the velocity along the x and y axises
    268.                 handleGutter();
    269.  
    270.                 //if the ball is greater then 1 move the ball "centre" of the left gutter lane
    271.                 Vector3 pos = transform.position;
    272.                 if(pos.x>0)
    273.                 {
    274.                     pos.x = gutterPositions.y;
    275.              
    276.                 }
    277.                 //if the ball is less then 1 move the ball "centre" of the right gutter lane
    278.                 if(pos.x<0)
    279.                 {
    280.                     pos.x = gutterPositions.x;
    281.                 }
    282.                 m_startGutterXPos = transform.position.x;
    283.                 m_gutterPos = pos.x;
    284.                 m_gutterTime=0;
    285.                 //m_moveToGutterCenter = true;
    286.                 //warp the ball to this position
    287.                 transform.position =pos;
    288.             //    iTween.MoveTo(gameObject,iTween.Hash("x",pos.x,"time",1));
    289.             }
    290.  
    291.         }
    292.  
    293.  
    294.  
    295.         }
    296.  
    297.      
    298.     }
    299.  
    300.  
    It's on line 71 is where the error is.


    Also, I was hoping if you could tell me how to slow down the ball. On phones it rolls too fast.
     
    Last edited: Jul 18, 2014
  40. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    It actually works now!!! But the ball goes so fast it's hard to tell. Can you tell me how to slow down the ball. I want to slow down the max by like 3x what the speed is now.

    Also can you tell me how to get rid of the arrow before you throw it.


    This is awesome stuff now. I hope this sold enough for future updates.
    Stuff I would want in future updates
    -ball select (like the alley select and could be on same page)
    -Other than that just better pin physics and better ball collision detection with the pins.

    Cool stuff man can wait to hear back!
     
    Masbantoel likes this.
  41. Shigidy

    Shigidy

    Joined:
    Dec 14, 2011
    Posts:
    441
    The thing I really want most for the next update is better physics. The ball, the pins, the interaction between them. If you could get that closer to real life I would be happy.
     
  42. faraz

    faraz

    Joined:
    Aug 4, 2014
    Posts:
    46
    game is not running in 4.5.x
     
  43. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Can the ball be made to curve by flicking in an arc? Thank you
     
  44. Robomagic

    Robomagic

    Joined:
    Mar 24, 2014
    Posts:
    7
    I have very big problem with pool starter kit. Please help me. Details in image attached.

    Please help me soon.

    My order Email is: hoang2909@gmail.com
     

    Attached Files:

    • Bug.png
      Bug.png
      File size:
      312.4 KB
      Views:
      1,125
  45. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Okay try going into PoolCue.cs and change the line 307

    from rch.normal to Vector3.right
    Code (CSharp):
    1.                         Vector3 reflectVec = Vector3.Reflect(-incomingVec, rch.normal);
    2.  
    3.  
    4.                         Vector3 reflectVec = Vector3.Reflect(-incomingVec, Vector3.right);
    5.  
     
  46. Robomagic

    Robomagic

    Joined:
    Mar 24, 2014
    Posts:
    7
    Thank for fast reply!
     
  47. Robomagic

    Robomagic

    Joined:
    Mar 24, 2014
    Posts:
    7
    I aready change PoolCue.cs but the problem still exist.
     
  48. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Anyway its somewhere around there in the pool cue class.

    Code (CSharp):
    1.                         Vector3 dir = Vector3.Reflect ( m_whiteBall.transform.forward,nrm).normalized;
    2.                         m_lr2.SetPosition(0,rch.point);
    3.  
    4.                         Vector3 mirrorPos = rch.point + Quaternion.AngleAxis(angleReflect,Vector3.up) * dir.normalized * reflectDistance;
    5.                         m_lr2.SetPosition(1,mirrorPos);
    6.  
    7.                         m_targetPos = mirrorPos;
     
  49. Robomagic

    Robomagic

    Joined:
    Mar 24, 2014
    Posts:
    7
    I'm not good at about C# and vector so if you have free time in next 1 - 2 days please help me fix this this. I wait for you. Thank you!
     
  50. Robomagic

    Robomagic

    Joined:
    Mar 24, 2014
    Posts:
    7
    I'm still waiting for you!