2
\$\begingroup\$

I'm trying to make a croquet mallet swing to hit the ball using an animation that rotates the mallet mesh. The mesh appears correctly positioned to hit the ball in the center but the ball doesn't go straight. Using a script with rigidBody.AddForce works fine. I do have Animate Physics selected on the animator and have explored many other options. Is there a way to debug the physics in this situation? Am I going about it the wrong way to use an animation to apply a force?

This is what it looks like now:

croquet mallet swing

\$\endgroup\$
  • 2
    \$\begingroup\$ I'd personally look into just applying a force to the ball based on player input and just have the mallet animation match. More reliable that way if the physics engine ever glitches out. In the interest of your question though, which collider types are you using for the ball and the mallet and what's the shape of the collision mesh if you're using a MeshCollider? \$\endgroup\$ – Coburn Aug 12 '16 at 16:59
  • \$\begingroup\$ @Coburn the mallet is using a convex mesh collider. The ball is using a sphere collider. The collider material options appear to have no effect. \$\endgroup\$ – Reed G. Law Aug 12 '16 at 17:34
  • \$\begingroup\$ what is the weight of the mallet / weight of the ball? \$\endgroup\$ – Gnemlock Aug 13 '16 at 2:30
  • \$\begingroup\$ For the mallet, try a capsule collider with a small radius: docs.unity3d.com/Manual/class-CapsuleCollider.html . If the radius is zero, it may behave like a normal cylinder (I've never tried this). But I would still do what @Coburn suggested and apply the force directly to the ball. \$\endgroup\$ – Doug.McFarlane Aug 16 '16 at 17:45

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.