WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-07-2013, 07:24 AM
bzyqo bzyqo is offline
Member
 
Join Date: Aug 2013
Posts: 6
Exclamation Player - avatar distance

Guys I have a small problem. Basically I would like to calculate the distance between the avatar and the main camera (player) in the scene. Do anyone have some kind of idea how to do that?
Reply With Quote
  #2  
Old 08-07-2013, 03:29 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You can use the vizmat.Distance command to calculate the distance between two points:
Code:
import viz
import vizmat
import vizact
viz.go()

avatar = viz.addAvatar('vcc_male2.cfg',pos=[0,0,5],euler=[180,0,0])
head = avatar.getBone('Bip01 Head')

def printDistance():
	avatarPos = head.getPosition(viz.ABS_GLOBAL)
	viewPos = viz.MainView.getPosition()
	distance = vizmat.Distance(avatarPos,viewPos)
	print distance
	
vizact.ontimer(1,printDistance)
Reply With Quote
  #3  
Old 08-09-2013, 11:16 AM
bzyqo bzyqo is offline
Member
 
Join Date: Aug 2013
Posts: 6
Thank you so so much !!
Reply With Quote
Reply


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
Avatar & Motion Capture Interface Angie Vizard 1 08-05-2010 07:17 PM
avatar scale and link.setpos conflict? sircedric4 Vizard 0 09-29-2009 08:48 AM
Collision of an avatar with a quad Frank Verberne Vizard 8 06-04-2008 10:44 AM
Looking through the eyes of an avatar Frank Verberne Vizard 2 04-01-2008 06:52 AM
How to make avatar's eyes to blink when speaking michelcm3 Vizard 12 01-15-2008 09:48 AM


All times are GMT -7. The time now is 04:28 AM.


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