I’d like to create a “true” capsule shape, as a multi-element of two circles at ends and a rectangular polygon joining them (as opposed to approximating it entirely with polygons, because I have reason to prefer the behavior of a true circular curve on the ends).
This doesn’t appear to be possible, as there doesn’t appear to be any way to specify an x/y offset of the component circle shapes.
For instance, and leaving out other details like bounce,density,friction,filter to simplify since they don’t matter here:
local obj = display.newImageRect("capsule\_126x30\_in\_128x32\_rect.png", 128, 32) local props = { { radius=15 }, -- left-side semi-circle, should be offset by x=-48 { shape={ -48,-15, 48,-15, 48,15, -48,15 }}, -- central joining rect { radius=15 }, -- right-side semi-circle, should be offset by x=48 } physics.addBody(obj, "static", unpack(props))
But (obviously) this just creates two circles centered within the rectangle, not at its ends.
Are there any “undocumented” properties of the body spec that would allow me to specify the x/y of those individual circle shape fixtures?
Or is there any other method to get those circles in there where they belong, avoiding polygonal approximation of the entire body? (also would rather avoid creating three separate bodies and two welds to hold them together)
Thanks!