WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-16-2009, 10:54 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
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
Reply With Quote
  #2  
Old 02-17-2009, 12:46 AM
DrunkenBrit DrunkenBrit is offline
Member
 
Join Date: Dec 2008
Location: England
Posts: 25
Try the tutorials inside of Vizard (Help->Tutorials). There's a whole section on avatars, it's a good starting point.
Reply With Quote
  #3  
Old 02-17-2009, 01:39 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
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
Reply With Quote
  #4  
Old 02-17-2009, 01:53 AM
DrunkenBrit DrunkenBrit is offline
Member
 
Join Date: Dec 2008
Location: England
Posts: 25
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)
I think you'll need something like the above anyway. Hope it helps.

As for the arm hitting the baloons, sorry i'm not fully understanding what you're meaning.
Reply With Quote
  #5  
Old 02-17-2009, 02:13 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
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,
Reply With Quote
  #6  
Old 02-17-2009, 02:48 AM
DrunkenBrit DrunkenBrit is offline
Member
 
Join Date: Dec 2008
Location: England
Posts: 25
If you want the arm to move wouldn't that be done by an animation of his arm moving 40 degrees?
Reply With Quote
  #7  
Old 02-17-2009, 03:13 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
So, how can I let him hit the balloon by his hand?
Reply With Quote
  #8  
Old 02-17-2009, 03:26 AM
DrunkenBrit DrunkenBrit is offline
Member
 
Join Date: Dec 2008
Location: England
Posts: 25
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
Reply With Quote
  #9  
Old 02-17-2009, 04:51 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
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)?
Reply With Quote
  #10  
Old 02-17-2009, 04:58 AM
DrunkenBrit DrunkenBrit is offline
Member
 
Join Date: Dec 2008
Location: England
Posts: 25
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.
Reply With Quote
  #11  
Old 02-17-2009, 05:03 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
my question about the ballooncollision; how?
Reply With Quote
  #12  
Old 02-17-2009, 05:12 AM
DrunkenBrit DrunkenBrit is offline
Member
 
Join Date: Dec 2008
Location: England
Posts: 25
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.
__________________
Software Developer
Virtalis Ltd.
www.virtalis.com
Reply With Quote
  #13  
Old 02-17-2009, 06:36 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
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,
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -7. The time now is 06:18 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC