This should be my final question regarding getting a catapult to throw something in unity. On my last question, someone suggested starting with something simpler (which I apologize for not doing earlier). It worked, so in my test project I put some shapes together to roughly approximate my catapult to see if it could throw something. Catapult setup


here's the code on arm rotation parent(which I made so that the arm rotated like a catapult arm)

if (Input.GetKey(KeyCode.Space))
            _rigidbody.AddTorque(new Vector3(0,0,1));

This version rotated and pushed the ball along with it,but it didn't throw it very much. Weird things started to happen when I increased the z magnitude of the torque vector(to 5). Here are my physics settings

  • Arm rotation parent
    • rigidbody with interpolate on, frozen every way except z rotation
  • ball guide
    • kinematic rigidbody with interpolate on
    • mesh collider with its shape
  • floor
    • default cube box collider
    • kinematic rigidbody with interpolate on
  • cube(this is the arm connecting the cup to the center)
    • default box collider for cubes
    • kinematic rigidbody with interpolate on
  • ball
    • sphere collider
    • gravity rigidbody with interpolate on

When I spin the arm, the ball almost completely passes through the floor, barely affected by it. On the next rotation, it does the same thing. here's a gif of what it does:

enter image description here

How do I get the cup of the catapult to interact more accurately and completely with the ball? I increased the physics fps to 100 to see what would happen, and that didn't fix it. Let me know if you need more info, thanks!

  • \$\begingroup\$ Have you put the physics in fixed update? I heard that can fix it sometimes. \$\endgroup\$ – ken May 11 at 19:00
  • \$\begingroup\$ @ken Yes, it didn't change anything \$\endgroup\$ – Nathan Wolf May 11 at 20:04
  • \$\begingroup\$ I got this problem once before. I resolved it by slowing the force down by a lot. If that doesn’t help, I might try expanding the collider size on the floor to reach much below it. \$\endgroup\$ – ken May 11 at 20:07
  • \$\begingroup\$ Do you have your Rigidbodies configured for continuous collision detection (CCD)? The workarounds suggested by Ken would only be necessary if you don't have CCD enabled, but it's generally better to enable CCD than to use a workaround. \$\endgroup\$ – Kevin May 12 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.