|
#1
|
|||
|
|||
Avatar
Hi all,
I am beginner on vizard, I am trying to build avatar walking with different speeds (I will control this speed by keyboard), this avatar should hit balls or whatever on his way by knife carrying by him Could you please any one help me how can I do this? Thanks |
#2
|
|||
|
|||
Try the tutorials inside of Vizard (Help->Tutorials). There's a whole section on avatars, it's a good starting point.
|
#3
|
|||
|
|||
Many thanks for your reply. I have read all the examples at teacher book, and I have done well at most cases. What I am doing now? I am trying to control the avatar walking through the keyboard (for example when I press + the speed increase and when I press – the speed decline and so on) as well as I want when I press space the arm of the avatar hit the balloons.
Am I wondering for the last points (arm and hit the balloon)? Please any help. thanks |
#4
|
|||
|
|||
Do you have the avatar walking around? If so you'll need a keyboard callback function to control the speed, something like:
Code:
# Load avatar myAvatar = viz.add('avatar.cfg') # Speed of avatar avSpeed = 1.0 def myKeyboard(key): global avSpeed # Increase speed on key press if key == '+': avSpeed = avSpeed + 0.5 myAvatar.speed(avSpeed) # Decrease speed on key press if key == '-': avSpeed = avSpeed - 0.5 myAvatar.speed(avSpeed) # Assign callback function to keyboard event viz.callback(viz.KEYBOARD_EVENT,myKeyboard) As for the arm hitting the baloons, sorry i'm not fully understanding what you're meaning. |
#5
|
|||
|
|||
First of all many thanks for your help that is fabulous. I tried to let the avatar to hit the balloon while he is walking by the knife link with his hand. What I cant to do -although I did it in many examples- to move his arm with the knife (around 40 degree) to hit the balloon.
thanks, |
#6
|
|||
|
|||
If you want the arm to move wouldn't that be done by an animation of his arm moving 40 degrees?
|
#7
|
|||
|
|||
So, how can I let him hit the balloon by his hand?
|
#8
|
|||
|
|||
Well, at a guess, you could always just hardcode it and position the balloon near the path the avatar moves along and when it gets to the position the balloon is in the world run the animation that moves his arm as if to strike the balloon.
If you've got variable moving speeds in there, i'd probably attempt to check the distance between the avatar and the balloon, once the avatar reaches a certain distance from balloon you could trigger the animation once to swing his arm (change the "trigger animation distance" between the avatar and balloon until you get it right). I haven't worked with avatars before in depth, only through the tutorials so if there's a better/easier way someone else would have to jump in and assist you. Like I said, this is at a guess |
#9
|
|||
|
|||
The arm moving is done but to hit the balloon I could not understood this concept from the examples (any body can help me how this is working)?
|
#10
|
|||
|
|||
Like i've said in the above post, simulate a collision based on events i.e your conditions could be:
IF armMoving == True AND distanceBetweenArmAndBalloon < strikeDistance balloonCollision = True Something like this would be checked maybe each 0.05 seconds in a timer callback function. Then take whatever action you need when the balloon is struck. |
#11
|
|||
|
|||
my question about the ballooncollision; how?
|
#12
|
|||
|
|||
Sorry, i've done my best to try and explain how i would initially go about it based on what I think you're after achieving and without seeing your code so far and the current world you've created.
|
#13
|
|||
|
|||
I appreciate your efforts with me. I am just trying to understand some concepts before to go in my world. However, I will email you the world that I am playing with now.
Thanks, |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Has user perception of avatar expressions been tested? | Karla | Vizard | 3 | 10-28-2008 10:32 AM |
Collision of an avatar with a quad | Frank Verberne | Vizard | 8 | 06-04-2008 09:44 AM |
Looking through the eyes of an avatar | Frank Verberne | Vizard | 2 | 04-01-2008 05:52 AM |
avatar neck too short | aa-chris | Vizard | 2 | 10-16-2007 09:28 AM |
Avatars in an array and link/unlink | betancourtb82 | Vizard | 7 | 09-05-2006 04:06 PM |