Download

Play sound based on the z value of physical door

i have a door with physics constraint that opens up by pushing it. so I want to be able to play a creaking sound based on the value of Z so if the value is 20 play 20% of sound effect and stop and if the value is 45 play half of it and so on. but if it starts going backwardly it plays a different sound effect. i know I have to use tick for this but is there a function I can use to get what I want?

It’s much easier to have a wave that’s longer than you need for the door, ideally looped.

When the door starts moving, start the sound from some random point, when then door stops moving, stop the sound.

That way, you also get a lot of variation if the player keeps fiddling with the door.

I wanna play the sfx if the door is actually rotating and as soon as it stops rotating i wanna stop playing it. So i should monitor the z value of the mesh somehow

Yes, that’s what I’m saying.

It’s more of a pain if you’re trying to do it with physics. You have to look and see if the door is moving…

yeah the problem i have right now is checking if the door is rotating and what angle it’s currently at.

You don’t need to know the angle, just if it’s rotating…

Just use this to know if the door is moving

this is the same as putting an overlap event, its not accurate cuz it plays the sfx if the door rotates the tiniest bit. i want to play the sound while the door is rotating and stop if the door stopped rotating.

man it would be really great if someone could actually help I’m stuck in my development and I’ve got bills to pay :sleepy:

You have the answer here.

I just test this, it works:

it works perfectly thanks!