Jump to content
  • Advertisement
Sign in to follow this  
deltaKshatriya

Unity Unity3d Sound and Physics

This topic is 773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wasn't too sure where to post this so I'm posting here. If anyone wants to move this post, feel free. I've been doing some stuff in Unity3d on the side, and decided to add in sound. Whenever I add in sound, it distorts the game I've made. I'll be more specific.

 

I have 5 aircraft doing a flyby. They are making use of the physics engine to realistically simulate the effects of adding force. So there's only a lift force and the physics engine's gravity force on the aircraft. The aircraft are also translated forwards. There's a rotation as well. It works fine without the sound, just the way I want it to. When I add in a sound source, it's as if the up force is not be added every frame. The planes don't fly in the same manner as before. It only works as before if I add more force to the aircraft. Any ideas what causes that?

Edited by deltaKshatriya

Share this post


Link to post
Share on other sites
Advertisement

I figured it out actually. It seems that selecting a Audio Source game object in the inspector will slow down the game overall but will otherwise be fine. I can sort of see why that would be.

Share this post


Link to post
Share on other sites

I'd also take a look at where you are adding force to the aircraft. If you are doing this in update, this could cause problems when framerate varies. You are modifying the resulting force vector depending on the framerate, while it is processed at a rate independent of the framerate. The same goes for the translation

 

You 'fixed' the problem for now, but I still suggest you apply your logic in FixedUpdate instead, if that's not what you are doing right now.

Share this post


Link to post
Share on other sites

I'd also take a look at where you are adding force to the aircraft. If you are doing this in update, this could cause problems when framerate varies. You are modifying the resulting force vector depending on the framerate, while it is processed at a rate independent of the framerate. The same goes for the translation
 
You 'fixed' the problem for now, but I still suggest you apply your logic in FixedUpdate instead, if that's not what you are doing right now.


You're right! I forgot about fixed update! It's been a while since I've used unity, so I'm a little rusty.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!