Three changes and it will work.
1. Make the gravity local variable static. Since it’s in a group it’s just a local and gets reset to 0 every tick as is.
2. Make the gravity variable x50 times what you use for the physics behavior gravity. Why? With box2d the standard use is to scale the physics units from the pixel units. That shouldn’t affect us but when they made the behavior they didn’t make sure the units were all uniformly converted. So x50 comes up a lot.
3. Use (vx,-vy) when you set the velocity. A negative was forgotten when solving the formula.
And as a bonus:
4. Use (vx,-vy-gravity/60/2) when you set the velocity. Without that the path will be slightly lower than the target. Why? There is something off when things update in the behavior. It applies gravity once. However I think this mainly happens when objects with physics are just created. I honestly forget, but in the chipmunk behavior I made a point to avoid that quirk.
Cheers