Hello, I'm currently trying to create a script for a custom action, it should play a sound when the character's mouse is over the scenenode "tapeRecorder". I've tested it out, but it doesn't play the audio. It doesn't return any sort of error message in the debug menu, and I believe it might have something to do with where the file is.
Here is the code.
/* <action jsname="action_InteractButtonAudio" description="Interact With Audio"> </action> */ action_InteractButtonAudio = function() { };
action_InteractButtonAudio.prototype.execute = function(currentNode) { var mouseX = ccbGetMousePosX(); var mouseY = ccbGetMousePosY(); var note = ccbGetSceneNodeFromName("tapeRecorder"); var mouse3DPos = ccbGet3DPosFrom2DPos(mouseX, mouseY); var camera3DPos = ccbGetSceneNodeProperty(ccbGetActiveCamera(), "Position");
if (ccbDoesLineCollideWithBoundingBoxOfSceneNode(note, camera3DPos.x, camera3DPos.y, camera3DPos.z, mouse3DPos.x, mouse3DPos.y, mouse3DPos.z)) { ccbPlaySound("Tape.wav"); } }
|