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

Physics See-saw Style Catapulting

Discussion in 'Getting Started' started by Necropolitan13, Mar 24, 2020.

  1. Necropolitan13

    Necropolitan13

    Joined:
    Feb 27, 2020
    Posts:
    8
    Alright, so the title might be a little confusing, so let me elaborate. I'm making a physics puzzle game where you tilt a board and roll a ball around. So far, I have a plane that I can tilt using mouse movement, and a sphere on top that can roll around using the physics system when the plane is tilted.

    Something I'd like to do to add some interesting gameplay is have the ability to catapult the ball into the air, perhaps to reach other platforms above or collect some floating objects. However, when I try to test this capability with what I have so far, the ball tends to fall through the plane due to the plane moving too fast for the collision system, I guess. So I'm not sure if the ball would even launch if it didn't fall through.

    I'm hoping someone can help me get the ball to not fall through when moving the plane above a certain speed, and if you know of any additional work that would have to be done to get it to actually launch off the plane using the physics system. I'm not necessarily looking for complete solutions, just a trail to follow to get it working.

    Edit: Well after a quick tweak to the physics (fixed) timestep in the project settings (halving it from 0.02 to 0.01) the problem with the ball falling through the plane seems to be resolved. I'm not sure if that is the best way to fix that particular problem, hopefully someone will let me know if it isn't and offer an alternative. I imagine that will have an impact on performance if I have a lot of physics objects in the scene, though currently I don't think that will be the case at any point, most likely only one or two balls with several platforms. This also has allowed me to see that the ball does get a little bit of air when the plane stops, so perhaps with a bit more tweaking I can get the result I want. Still, if anyone has any further insight or advice on this particular type of mechanic, I'd be happy to read it!
     
    Last edited: Mar 24, 2020
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,851
  3. Necropolitan13

    Necropolitan13

    Joined:
    Feb 27, 2020
    Posts:
    8
    Yeah, I took a look in the scripting forum and saw this suggestion as well. I changed my objects to that, still fiddling with it. So far I have still had a few cases of the ball falling through when the plane is moving fast enough. Would it be better to use a thin/flat, wide cube rather than a plane?

    Something that may make this more complicated is that the plane is pivoting on its center, so the further from the center the ball is, the faster the plane will move, meaning that this problem is more prominent as the ball approaches the edges of the plane.