Need help making a lever work the right way? Thanks!

SAMmanSAMman Member Posts: 228
edited November -1 in Working with GS (Mac)
Hi all,
I am new to gamesalad and decided to make a game, go figure. Anyway, I am having trouble getting my physics right. I want to drop a ball on a lever and send another ball flying. Ball A is dropped and Ball B is already sitting on the lever on the side opposite to the ball A is dropped. I want to use acceleration of ball A falling plus the distance from the center of the lever that it is dropped to calculate power. That is problem 1. Problem 2 is starting out ball B on the lever and having it stay on the lever until the lever hits a certain angle, 30 degrees for example, and then Ball B launches with power based on the height of Ball A and it's distance from the center of the lever.

So far I have gotten the power based on the acceleration to work using a timer. And I spawn an actor when the lever hits 30 degrees. But it's certainly not looking good. Anyway, any help would be very much appreciated. Thanks everyone!

Comments

  • old_kipperold_kipper Member Posts: 1,420
    This is not something I've done, but I've worked on elements that might help. If you haven't already check out the pinball template in GS. This shows that the launch off the lever is possible and I would put a hidden object in the scene to hold the second ball it place until launched (and not spawn it). And the striking of the lever and the transmission of the data... I think that would be just an adjustment of the rotational speed of the lever based on position at impact and your timer acceleration measurement. So on impact you would put the dropping ball x into a game attribute, then pick it up in the lever actor in a rule that was something like change self rotational speed to (my clever timer for acceleration number Multiplied by distance been self x and game attribute for impact of dropped ball)/number that brings it into being useful.

    This approach may be floored. And there are issues of the speed of intersection between colliding objects so if you flip with the lever too fast it don't work... This can be partially sorted with adjustments to mass, and other physics. If it doesn't, cheat it with a direct injection of change velocity in ball 2 based on the above... And of that don't work... Ask somebody else with a more youthful brain.

    Hope that helps

    Kipper
  • SAMmanSAMman Member Posts: 228
    That does help! Thanks, I will give it a try!
  • old_kipperold_kipper Member Posts: 1,420
    Good luck and I note I should be floored for my flawed use of floored.

    kipper
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I just created a simple lever demo using physics instead of math. There seems to be a weird collision thing going on with the lever but it may help get you started.

    search "lever demo" in the new section of GS creator.
  • old_kipperold_kipper Member Posts: 1,420
    scitunes said:
    There seems to be a weird collision thing going on with the lever...

    Well cool Scitunes! Just push up the plank density to 1000 and it works great. And fiddling with the friction and making the balls round makes it work even better.
  • SAMmanSAMman Member Posts: 228
    Awesome, Thanks for all the help! I will let you know how it goes.
  • SAMmanSAMman Member Posts: 228
    Everything works great, but I have encountered a new problem. When I place 2 levers in the same scene the second lever does not interact with ball 2. Basically here is what I have done. I created ball 1 and ball 2 and lever 1 and lever 2. Lever 1 is placed lower than lever 2 ad slightly to the left of lever 2. ball 2 starts placed on lever 1. By dropping ball 1 on lever 1, ball 2 is launched into the air and lands on lever 2 above lever 1. That all works fine. But then I want to launch ball 2 again from lever 2. When I proceed to drop ball 1 on lever 2, it just passes right through the lever and ball 2 just sits there. Any suggestions? Thanks for the help!
Sign In or Register to comment.