perfect! =D I just need to use length/2 to get the center. tks all
2012/8/21 Silver <[email protected]> > try using math.sin() and math.cos() > > for example: > > lets call the position of the shoulder shoulderPosition which is a tuple > (0,0) > lets call the angle you want to rotate it to angleShoulder (in radians, > to convert from degrees use math.radians() > lets call the length of the upper arm upperArmLength > > then > > elbowPosition = > (upperArmLength*math.cos(angleShoulder)+shoulderPosition[0], > upperArmLength*math.sin(angleShoulder)+shoulderPosition[1]) > > then you can center your image there and rotate it. > > Heres an image on how it works > > On 8/21/2012 10:08 AM, Ricardo Franco wrote: > > Hi, guys. Tks for the answers, but I didnt understand how to rotate it > yet. > > I made a workaround by putting my arm image inside a blank square cover, > so > > the center of the image is where I want. > > This way I can rotate around the center and get the spected result with > the > > arm -> shoulder joint. > > But I cant get a good result within forearm -> arm joint. > > > > 2012/8/20 Christopher Night <[email protected]> > > > >> Right, but note that performing step 2 with pygame.transform.rotate is > not > >> trivial, since it doesn't rotate about the origin, or any particular > point > >> for that matter: the fixed point of rotation depends on the surface > >> dimensions and the rotation angle. So your step 2 is itself 3 steps. > >> > >> For this reason, I generally anchor all my blits to the surface's > center. > >> In this case I would make it easy on myself by adding some margin to the > >> image so that the desired rotation point is at the center of the image. > I > >> know not everyone likes to do it that way, though. > >> > >> -Christopher > >> On Aug 20, 2012 4:32 PM, "Mark Wexler" <[email protected]> wrote: > >> > >>> To rotate around an arbitrary point, > >>> 1. subtract (vectorially) the center of rotation; > >>> 2. perform rotation (as if about the origin); > >>> 3. add the center of rotation. > >>> > >>> Mark > >>> > >>> > >>> On Mon, Aug 20, 2012 at 10:10 PM, Ricardo Franco > >>> <[email protected]> wrote: > >>>> Hi, I need to rotate around a specific point. > >>>> It's a person animation. So the arms should rotate over the shoulders' > >>>> point. > >>>> How to do that? > >>>> > >>>> -- > >>>> Ricardo Franco Andrade @ricardokrieg > >>>> > >>>> ( Game | Desktop | Web ) Developer > >>>> > >>>> email: [email protected] > >>>> contact: +55 (86) 9958 9725 > >>>> +55 (86) 9436 0830 > >>>> twitter: twitter.com/ricardokrieg > >>>> facebooK: https://www.facebook.com/krieg.ricardo > >>>> github: https://github.com/ricardokrieg > >>>> > >>> > >>> > >>> > >>> -- > >>> Mark Wexler > >>> Laboratoire Psychologie de la Perception > >>> CNRS - Université Paris Descartes > >>> 45, rue des Saints-Pères > >>> 75006 Paris, France > >>> http://wexler.free.fr > >>> > >> > > > > > > > -- > O< ascii ribbon campaign - stop html mail - www.asciiribbon.org > -- Ricardo Franco Andrade @ricardokrieg ( Game | Desktop | Web ) Developer email: [email protected] contact: +55 (86) 9958 9725 +55 (86) 9436 0830 twitter: twitter.com/ricardokrieg facebooK: https://www.facebook.com/krieg.ricardo github: https://github.com/ricardokrieg
