Kallas,
I think what you are doing is to rotate the axis of rotation for the box Chest,
but not rotate the box itself. Although I use a bit different notation for rotation
I updated your code like the following and it seems to work as you like:
... ... ...
caxis=rotate( Chest.axis, utp ,(1,0,0) ) ### THIS IS YOUR FAMOUS LINE
### THIS WORKS BETTER WITH (1,0,0) RATHER THAN (2,0,0)
caxis=rotate( caxis , uth ,(0,1,0) )
caxis=rotate( caxis , uty ,(0,0,1) )
SPL=ShoulderPosL
print utp
# Add this later to move arm with upper torso rotations
# SPL=rotate( ShoulderPosL,utp,(1,0,0))
# SPL=rotate(SPL,uty,(0,0,1))
# SPL=rotate(SPL,uth,(0,1,0))
#Chest.pos=cloc #### DELETE THESE TWO LINES
#Chest.axis=caxis
Chest.rotate ( axis =caxis, angle=utp, origin=caxis) *** *** *** ADD THIS LINE FOR ROTATION
... ... ...
Also, you seem to have problems with angle values with sliders (past 2*pi).
I modified the slider scale for UTP, from -100,100 to -5,5 in class MAIN.
It seems to work OK now.
Good luck,
Kadir Haldenbilen.
----- Original Message ----
From: Kailas Narendran <ka...@my...>
To: vis...@li...
Sent: Tuesday, February 5, 2008 11:52:18 PM
Subject: [Visualpython-users] Visual Python Help
Hi! I'm working on a program in visual python and am running into a
weird problem (maybe it's my own user error, but I can't see what I'm
doing wrong)
To run the attached code, need wxpython installed too.
In my code, I've got a "human body" constructed using some primitive
blocks, cylinders, etc. I want to be able to model upper torso
movement, as well as arm movement that's recorded by some sensors placed
around the body.
The arm movement works great, and I can easily control the position and
rotation of the upper arm and elbow (all that I'm interested in).
The torso is behaving a bit strangely.
I have a Box object I create:
Chest = box ( pos=(0,HeadDiameter+SegmentSpace+HeadDiameter/2,0),
axis=(2*HeadDiameter,0,0), width=.75, height=HeadDiameter,
length=2*HeadDiameter, color=color.red)
And based on the "pitch", "yaw" and "heading" angles, I can rotate it.
When the chest pitches forward, it needs to rotate about the line that
goes through the gap between the torso and stomach, so I do the
rotations with the vectors, moving the position of the chest block, as
well as rotating it. (I actually tried the Rotate function for the
block itself with no success)
#(utp=pitch, uth=heading, uty=yaw)
cloc=UTOrigin+rotate(UTUnitAxis,utp,(1,0,0))*HeadDiameter/2
caxis=rotate( (HeadDiameter*2,0,0), utp,(1,0,0) ) ####
!!!! Why doesn't this make the check pitch forward?
caxis=rotate(caxis,uty,(0,0,1))
caxis=rotate(caxis,uth,(0,1,0))
Chest.pos=cloc
Chest.axis=caxis
As you can see from the code, for some reason the rotation that's
supposed to happen about the long axis of the box doesn't. the strange
thing is that the other ones work ok, so I'm not sure what I'm doing
wrong.
I've attached the code if you want to try and run it. The problem is on
line 48. You'll notice that the arm doesn't follow the torso just yet,
which is ok.
Any ideas?
Thanks!
-kailas
-----Inline Attachment Follows-----
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-----Inline Attachment Follows-----
_______________________________________________
Visualpython-users mailing list
Vis...@li...
https://lists.sourceforge.net/lists/listinfo/visualpython-users
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping |