WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-03-2008, 07:38 PM
mjabon mjabon is offline
Member
 
Join Date: Jul 2007
Posts: 63
Help with avatar.lookAt

Hi. I am trying to make an avatar enter a room, walk to a certain location, pause and look at two empty chairs (first at one and then the other) and then proceed to walk to one of the empty chairs. Here is my script:

Code:
partner.addAction(vizact.walkto(-2.15, 0, -0.1, WALK_SPEED, 90, viz.AVATAR_WALKSTEP))
partner.state(1)
###Here I need to look at each chair
partner.addAction(vizact.walkto(-1.1, 0, 1.4, WALK_SPEED, 90, viz.AVATAR_WALKSTEP))#walk to chair far
partner.state(1)
partner.addAction(vizact.spinto(0, 1, 0, 140, 200))
partner.state(1)
I tried using partner.addAction(vizact.lookat(-1.1, 0, 1.4,90)) to look at the chair (it is at (-1,1,0,1.4)). But this made the whole avatar turn, not the head. I looked in the manual and they said something about using the neck, but I have no neck bone in my resources.

I thought of using partner_head.setEuler(pitch,yaw,roll) However, when I do this it is not synchronized with the actions....it just tilts the head before he even starts walking! I thought perhaps I could just use a vizact.waitTime??

Also, if using head.setEuler is there any way to control the speed of the movement?

And if I can use head.setEuler, if I have two points (say I know the avatar is at point (x,y,z) and the chair I want to look at is at (a,b,c), how can I calculate what euler to set? Would I use viz.ABSOLUTE_GLOBAL or some relative scheme?



Finally, is there a way to make the avatar sit down slowly? Right now we just set their position and so they move down to the chair very quickly..

Any help would be appreciated!
Reply With Quote
  #2  
Old 07-04-2008, 11:38 AM
south_bank south_bank is offline
Member
 
Join Date: May 2008
Location: Wolverhampton
Posts: 11
To slow the movement of the head you can specify the fifth parameter to be time: for example:

addAction(vizact.spinto(0,1,0,90,2,viz.TIME))

With regards to the problem of the head rotating before you get to the chairs, have you tried using a hotspot (viz help) to trigger the action? If not, try using a hotspot placed between or behind the chairs with an if statement to rule the actions of the partner_head.

Otherwise, perhaps you could place a small box in the world where you want the avatar to stop and look around, turn collision on for the box and disable it from being rendered: object.disable(viz.COLOR_WRITE). Then write an if statement that runs the actions you want when it detects an avatar-box collision.

Hope it helps.
Reply With Quote
  #3  
Old 07-07-2008, 12:29 AM
mjabon mjabon is offline
Member
 
Join Date: Jul 2007
Posts: 63
Thanks for your reply. The problem is that using spin to spins the whole avatar. So does lookat. I need just the head to rotate like a real person looking to the left and right....
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


All times are GMT -7. The time now is 08:40 PM.


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