Spawn Sound and Fly through

Hello Unity Community,

my first Post, i hope i can explain my problem well.

I made a Video how i setup a StarShip and let it shoot, for this i use Large Blaster Assets.

Now i have problems with the Sound if i slow down my Ship i can hear the Sound good left and right.
But if i fly fast i just get ugly sounds.

here in this video you can see if the Ship is far away u have crazy sound (the ship is moving with 500 up to 1000) The shots should move around 2500 to 3000. The speed of the Ship is also various and can raise up to 1300 and also can be lower.

My only Solution is to fix the Camera Point in the center of my Ship to get clearly Sounds. But in this Arcade i want that the Camera zooming in and zooming out depending on Ships speed

Camera Script attachet to the Ship Parent Object:

using UnityEngine;
using System.Collections;

public class CameraMover : MonoBehaviour
{

    Vector3 targetPosition;
    public float distanceCheck = 30f;
    public float angularCheck = 7f;
    public float distanceBehind = 7f;
    public float height = 4f;

    void FixedUpdate()
    {
        targetPosition = transform.position - transform.forward * distanceBehind + transform.up * height;

        if (Camera.main)
        {
            Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, targetPosition, Time.deltaTime * distanceCheck);
            Camera.main.transform.localRotation = Quaternion.Slerp(Camera.main.transform.localRotation, transform.localRotation, Time.deltaTime * angularCheck);
        }
    }
}

in the Ship i call the Sounds with this Script

AudioSource.PlayClipAtPoint(sfxFire[_sfxRoundRobinFire], _b.muzzle.position, volumeFire);

but here i say already “PlayCipAtPoint” so he spawn the Sound File at the Position of the end of my Canonen (_b.muzzle.position) but nothing more so i fly with my Ship up to 1200 Units per second away from the Sounds.

i was thinking to add a Force to this so i attach a rigidbody to this and say the following lines of Code

PlayerController playerController;
Rigidbody rb;
private float thrust;

void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
thrust = PlayerController.shipSpeed;
}

// In the Fire Method
AudioSource.PlayClipAtPoint(sfxFire[_sfxRoundRobinFire], _b.muzzle.position, volumeFire);
rb.AddForce(transform.forward * thrust);

but not working xD, i hope someone can help my brain out to come behind this problem, looks like i have a barricade in front of me. Thanks

Edit:

i tried already to change the 3D Sound Settings, Doppler Level, Spread, Min and Max Distance
but whatever i setup theres a Sound Disoriantation when my Camera is behind the Ship.
When i go between the Weapons the Shot Audio called clearly

PlayClipAtPoint plays sounds at a static position. So you are flying past the sounds very quickly and they sound bad.
You should attach audiosources to the guns of your ship and use those to play the sounds. That way the sounds are attached to the ship, and you aren’t flying past them.

1 Like

Hehe i wanted to say now

but i just spawn it at this position xD and the position is in 1 second up to 1300 meter behind me.

now i fixed the problem i let play the sound in a Audio Source i attach to the Ship Model
and just replace in the Fire Method the “PlayClipAtPoint” with

public AudioSource shotListener;

// In Fire Method
shotListener.PlayOneShot(sfxFire[_sfxRoundRobinFire]);

so thank you, you bring me on the right way.