WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 08-19-2009, 06:17 PM
GiudiceLab GiudiceLab is offline
Member
 
Join Date: May 2009
Location: Orono, ME
Posts: 49
Attaching sound to a moving object

I am working on figuring out the more complex sound properties and functions in pySonic. I am trying to get a helicopter-style test script to work (where the sound source circles the listener). I can have a sound play successfully if I move the object--a duck--or if I move the viewpoint relative to the duck, but if I use this code:
Code:
duck.center(0,0,radius)
duck.translate(0,0,-radius)
duck.addAction(vizact.spin(0,1,0,45))
#duck.playsound('quack.wav',viz.LOOP)
sound.LoopMode = pySonic.Constants.FSOUND_LOOP_NORMAL
sound.Play()
the duck will circle, but the sound source won't follow it like it does if I use viz's playsound function.

If I output the duck's position, it does not change, so this is really why the sound doesn't update. So I guess my real question is, how do I get the duck's position during this action?
__________________
Virtual Environments and Multimodal Interaction (VEMI) Lab

This time, it should work...
Reply With Quote
  #2  
Old 08-19-2009, 06:21 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
How are you retrieving the duck's position? The following code should work in your case:
Code:
duck.getPosition(viz.ABS_GLOBAL)
Reply With Quote
  #3  
Old 08-20-2009, 08:11 AM
GiudiceLab GiudiceLab is offline
Member
 
Join Date: May 2009
Location: Orono, ME
Posts: 49
That seems to have done the trick, thanks. I was using just
Code:
duck.getPosition()
I guess the default is viz.ABS_PARENT, but I don't understand why it works when the object is not in motion.
__________________
Virtual Environments and Multimodal Interaction (VEMI) Lab

This time, it should work...
Reply With Quote
  #4  
Old 08-20-2009, 10:41 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
It had nothing to do with the object being in motion. It had to do with the use of the node.center command. Changing the center and spinning the object will affect it's global position, but it's local position is still where you initialized it to (0,0,-radius).
Reply With Quote
  #5  
Old 08-20-2009, 01:18 PM
GiudiceLab GiudiceLab is offline
Member
 
Join Date: May 2009
Location: Orono, ME
Posts: 49
I see. That makes sense. Another thing I can't figure out, though: the duck circles but at an angle, so it dips below the floor halfway around and then comes back up. Any ideas on why that's happening?
__________________
Virtual Environments and Multimodal Interaction (VEMI) Lab

This time, it should work...
Reply With Quote
  #6  
Old 08-20-2009, 01:55 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Can you post a simple script that recreates this? It sounds like you might be modifying the pitch of the duck or your ground plane is not level.
Reply With Quote
  #7  
Old 08-21-2009, 09:52 AM
GiudiceLab GiudiceLab is offline
Member
 
Join Date: May 2009
Location: Orono, ME
Posts: 49
Tilted duck...

Aha! I figured it out when I was creating the test script for you--I had the duck looking at [0,0,0], which meant it was tilted. I changed it to the look at the correct height [0,height,0], then centered and translated it at the correct height and that fixed the issue.
Thanks anyway!
__________________
Virtual Environments and Multimodal Interaction (VEMI) Lab

This time, it should work...
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
retrieve Object names Geoffrey Vizard 11 12-11-2009 05:26 AM
moving and object by mouse but don't know how to stop the movement nlfrnassimi Vizard 8 04-26-2009 08:23 AM
Moving avatars lips with sound dan12345 Vizard 5 01-29-2008 08:32 PM
sound problem alaa Vizard 7 09-02-2005 02:13 PM
Moving view with object Xliben Vizard 2 07-25-2005 06:36 PM


All times are GMT -7. The time now is 11:45 AM.


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