How to rotate a physics body, with reference point at its edge

I have a rectangle, which I have made a physics body. 

I need to rotate the rectangle, with its reference point at its tip, to get a clock-hand-like effect. 
But apparently you can’t set reference point for physics bodies. 

What do I do here? 

One work-around suggested was <a href = http://forums.coronalabs.com/topic/32895-using-eg-topleftalign-on-a-physics-body-only-applies-to-its-appearance-not-its-body-help/> to create a fake object and get the positions from there</a> 
That is good for a single one-time rotation. I need to continously rotate the object using transition.to. 
How do I achieve this? 

Seems a major flaw in physics, unless I’m missing something pretty basic.

Hi @Satheesh,

Another possibility is to create an object that’s actually bigger than it appears (in image size) with transparent pixels in the “non collision” part. Create the image so that its center point is where you want to rotate it around, then create the physics body using a shape declaration so that the body itself is traced around the collision bounds you want (not auto-traced). This is probably the easiest way to handle what you describe, with the constantly-rotating transition.

Best regards,

Brent

Come on… So much complication for such a simple mechanism? 
Isn’t this a bit convoluted? 

Still, your solution makes sense. 
Will try it out :slight_smile:

Haven’t tried this but why not create another physics body at the rectangles tip, say a small circle for example.  Then weld the rectangle body to it and rotate the circle?

Yeah, I  did try this, but then I can’t use transition right? 
I have to apply some force to move the object… Transition just messes by the joint’s physics

Brent’s suggestion is pretty eloquent and not convolted at all in my mind.  Would take only a minute to get working.  Have you tried Brent’s way?

I am going to. And I’m pretty sure it would work too.
The solution itself is not convoluted. The fact that we have to resort to such work-arounds to implement something this basic is what makes it convoluted.

Hi @Satheesh,

Another possibility is to create an object that’s actually bigger than it appears (in image size) with transparent pixels in the “non collision” part. Create the image so that its center point is where you want to rotate it around, then create the physics body using a shape declaration so that the body itself is traced around the collision bounds you want (not auto-traced). This is probably the easiest way to handle what you describe, with the constantly-rotating transition.

Best regards,

Brent

Come on… So much complication for such a simple mechanism? 
Isn’t this a bit convoluted? 

Still, your solution makes sense. 
Will try it out :slight_smile:

Haven’t tried this but why not create another physics body at the rectangles tip, say a small circle for example.  Then weld the rectangle body to it and rotate the circle?

Yeah, I  did try this, but then I can’t use transition right? 
I have to apply some force to move the object… Transition just messes by the joint’s physics

Brent’s suggestion is pretty eloquent and not convolted at all in my mind.  Would take only a minute to get working.  Have you tried Brent’s way?

I am going to. And I’m pretty sure it would work too.
The solution itself is not convoluted. The fact that we have to resort to such work-arounds to implement something this basic is what makes it convoluted.