Question by
riskimaulana973 · Jul 16, 2019 at 05:46 PM ·
audiokinectavatar
The sound doesn't play on hit by DrumStick
Hello Everyone. I'm Sorry for my bad english.
I want to make Virtual Drum And Unity with Kinect V2. I make with Asset MS-SDK and Drum Kit. I put screenshoot my project below,
And you can see my Script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioManager : MonoBehaviour {
public AudioClip SnareDrum;
public AudioClip Ride;
public AudioClip MiddleTom;
public AudioClip HighTom;
public AudioClip HiHat;
public AudioClip Crash;
public AudioClip FloorTom;
public AudioClip BassDrum;
private AudioSource Source;
void Awake()
{
Source = GetComponent<AudioSource>();
}
void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "SnareDrum")
{
//Source.clip = ;
Source.PlayOneShot(SnareDrum);
}
if (other.gameObject.tag == "DKFYB_Ride")
{
Source.PlayOneShot(Ride);
}
if (other.gameObject.tag == "DKFYB_Middle_tom")
{
Source.PlayOneShot(MiddleTom);
}
if (other.gameObject.tag == "DKFYB_High_tom")
{
Source.PlayOneShot(HighTom);
}
if (other.gameObject.tag == "DKFYB_Hi-hat")
{
Source.PlayOneShot(HiHat);
}
if (other.gameObject.tag == "DKFYB_Crash")
{
Source.PlayOneShot(Crash);
}
if (other.gameObject.tag == "DKFYB_Floor_tom")
{
Source.PlayOneShot(FloorTom);
}
if (other.gameObject.tag == "DKFYB_Pedal")
{
Source.PlayOneShot(BassDrum);
}
}
// Update is called once per frame
void Update () {
}
}
I'm newbie,so i hope anyone can telling me what wrong or my mistake point !! ThanksYou
rifqi.png
(238.8 kB)
Comment
Your answer
Follow this Question
Related Questions
Vertical resolution of Kinect-v2 in Unity 3D 0 Answers
Kinect v2 avatar control examples ? 1 Answer
audio is not playing during IEnumerator 1 Answer
Cracking at end of audio? 0 Answers