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) 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? |
How are you retrieving the duck's position? The following code should work in your case:
Code:
duck.getPosition(viz.ABS_GLOBAL) |
That seems to have done the trick, thanks. I was using just
Code:
duck.getPosition() |
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).
|
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?
|
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.
|
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! |
All times are GMT -7. The time now is 10:16 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC