From b2507a787f26da5af85a44a862f7b04e07956d86 Mon Sep 17 00:00:00 2001 From: mhz1g21 <mhz1g21@soton.ac.uk> Date: Mon, 25 Nov 2024 15:55:40 +0000 Subject: [PATCH] attempt to fix moving speakers --- AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs b/AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs index 8099107..ae37c88 100644 --- a/AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs +++ b/AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs @@ -83,6 +83,13 @@ public class BuildRoom : MonoBehaviour { // Instantiate the speaker prefab GameObject speaker = Instantiate(interactableAudioSourcePrefab, new Vector3(x, y, z), Quaternion.identity); + // Ensure the speaker stays in place + Rigidbody rb = speaker.GetComponent<Rigidbody>(); + if (rb != null) + { + rb.isKinematic = true; + } + // Set the audio clip for the speaker AudioSource audioSource = speaker.GetComponent<AudioSource>(); audioSource.clip = Resources.Load<AudioClip>(audioPath); -- GitLab