#1
|
|||
|
|||
timing on a sequence of actions
Hi!
I am trying to animate an avatar using boneSpinTo driven by data coming in from FAAST. I've got this part working. What I'd like to do now is to scale the speed with which the avatar's bones spin to the current state of the tracking data. So, if the left arm of the person being tracked moves 30cm/sec, then the left arm of the avatar would move k*30cm/sec (until the avatar's left arm was at the rotation that the tracked person's arm was at). To do this I thought I'd use a sequence of actions, each of which covers a fraction of the total spin necessary to align the avatar and the tracking data: Code:
for bone in myBones: #find out where the bone needs to go targetEuler = trackerBones[bone].getEuler() #find where the bone was the last time it was moved tempEuler = bonesWereHere[bone] spinSequence = []; while True: #find discrepancy between where bone is and target diff = [x-y for x,y in izip(targetEuler, tempEuler)] #find amount by which to move bone towards target delta = [x*k for x in diff] # k is a scaling factor < 1.0 if delta != [0,0,0]: tempEuler = [sum(x) for x in izip(tempEuler, delta)] else: tempEuler = targetEuler break #make an action to spin the bone by the amount specified in delta spinIt = vizact.boneSpinTo(bone, mode = viz.ABS_GLOBAL, euler = tempEuler) spinSequence.append(spinIt) #now that all intermediate actions have been added, execute the sequence myAvatar.runAction(vizact.sequence(spinSequence)) Hope that makes sense! Any help is GREATLY appreciated! Thanks.. |
#2
|
|||
|
|||
I should also mention that the code above is from the update function of a custom action...
|
#3
|
|||
|
|||
The vizact.boneSpinTo command accepts a time or speed argument to control the speed of the animation. If you want to manually set the orientation of the bone each frame, you could use one of the set commands on the bone.
Perhaps there's an easier way to accomplish this. Vizconnect supports avatar IK. You can apply a scale factor to position movements of the trackers that are mapped to the avatar. |
#4
|
|||
|
|||
Hi Jeff, this is a lab account and our team has been unable to return to this problem recently but we now have the time to explore it further.
thanks for your input. We are using Vizard 4.0 and do not have access to vizconnect. Would you mind telling us more about the speed parameter in boneSpinTo? the documentation says only that it is the speed to spin at in degrees/sec. If we were to calculate the difference in euler angle between the bone at the last update and at the present update, and divide that by the update time, would that give us the speed? we could then scale that and use it as the speed parameter in bonespinto. If that is a good method, would you mind giving us a few pointers on how to go about calculating it? We're not super familiar with euler geometry around here. Thanks.. |
#5
|
|||
|
|||
Are you updating the avatar each frame based on tracking data? Or is the avatar in a different state than the tracked user and animated for some period of time to match up?
|
#6
|
|||
|
|||
Well, I'm not quite sure. That's sort of what I was asking in my original question. I was hoping to do the latter of your suggestions. The update function I wrote in the OP is called every frame. What I can't figure out is whether the sequence of actions strung together in the update function are executed individually (at a rate of 1/frame or some such) or whether the entire sequence is combined so that the end point of the sequence is achieved before the next frame. Thanks!!
|
#7
|
|||
|
|||
The vizact.boneSpinTo command is designed to animate the bone over a period of time, not per frame. If you don't specify a time or speed value in the vizact.boneSpinTo command then the change will be instantaneous, whether there is one or more actions in sequence.
|
#8
|
|||
|
|||
OK, thanks for that info, Jeff. That helps a lot. Can you think of any alternatives to using boneSpinTo that you think might fit with what we're trying to do? Are there particular advantages to using boneSpinTo that we might not be able to utilize if we go with, for example, setEuler on each frame?
|
#9
|
|||
|
|||
Hi Jeff,
I'm using vizact.boneSpinTo as well and I'm experiencing problems with it as well. I would like to have an avatar pointing at a certain location. Code:
import viz viz.go() point = vizact.boneSpinTo('Bip01 R UpperArm',mode=viz.AVATAR_LOCAL,point=viz.MainView.getPosition(),speed=90) #Add avatar model = viz.add('vcc_female.cfg',euler=(180,0,0)) def mykeyboard(key): if key == " " : model.runAction(point) viz.callback(viz.KEYBOARD_EVENT,mykeyboard) Troubles: 1: The avatar is not pointing at the correct location 2: The avatar is pointing at a different positions while the position of the mainview not changes. Could you please help me with this? Best, Jeroen Max Planck Institute Nijmegen |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trouble Exporting OSGB Animations via Sequence Helper (3Ds Max) | envi253 | Vizard | 1 | 06-05-2015 11:31 AM |
osg Sequence | TarkaDahl | Vizard | 4 | 09-01-2011 01:45 AM |
how to freeze sequence of actions | dwaik | Vizard | 1 | 04-05-2010 01:26 PM |
stopping a sequence | durf | Vizard | 1 | 04-14-2009 01:31 PM |
Weird lagging/choppiness when avatars perform actions | vjonshih | Vizard | 8 | 11-30-2004 04:08 PM |