Adding sounds to tension belts

User avatar
Eep
Posts: 75
Joined: Mon Nov 26, 2018 6:07 pm

Adding sounds to tension belts

Post by Eep » Fri Dec 07, 2018 9:21 am

Trying to add a sound to tension belts (specifically the Fliegl DPW180 trailer) but I don't understand where to put the <sounds> tag and what to start the tag with. I assume <sounds> goes inside the <tensionBelts> tag but I'm just guessing based on what I see <sounds> in other parts. Here's what I tried but it didn't work:

Code: Select all

    <tensionBelts>
        <tensionBeltsConfigurations>
            <tensionBeltsConfiguration>
                <tensionBelts linkNode="belts" jointNode="flieglDPW180_main_component1" width="0.075" maxEdgeLength="0.1" geometryBias="0.01" ratchetPosition="0.2" defaultOffset="0.1" defaultOffsetSide="0.1" defaultHeight="4" activationTrigger="beltActivationTrigger">
                    <tensionBelt startNode="beltStart1" endNode="beltEnd6" offsetLeft="1.3"/>
                    <tensionBelt startNode="beltStart2" endNode="beltEnd5"/>
                    <tensionBelt startNode="beltStart3" endNode="beltEnd4"/>
                    <tensionBelt startNode="beltStart4" endNode="beltEnd3"/>
                    <tensionBelt startNode="beltStart5" endNode="beltEnd2"/>
                    <tensionBelt startNode="beltStart6" endNode="beltEnd1" offsetRight="1.2"/>
		    <sounds>
			<tensionBelt template="SWITCH_01"/>
	            </sounds>
                </tensionBelts>
            </tensionBeltsConfiguration>
        </tensionBeltsConfigurations>
    </tensionBelts>
How do I know what to name the tag inside <sounds>? I just picked "tensionBelt" based on other vehicles but where are the sound tags defined? I know the sound templates are defined in data\sounds\soundTemplates.xml so "SWITCH_01" is defined there. Ideally, I want to have different sounds for fastening (showing) and unfastening (hiding) belts. Any ideas?

User avatar
Eep
Posts: 75
Joined: Mon Nov 26, 2018 6:07 pm

Re: Adding sounds to tension belts

Post by Eep » Sun Dec 09, 2018 10:33 am

Anyone?

User avatar
Eep
Posts: 75
Joined: Mon Nov 26, 2018 6:07 pm

Re: Adding sounds to tension belts

Post by Eep » Sun Dec 16, 2018 8:25 pm

so far I've got

Code: Select all

function TensionBeltSound:onUpdate(dt)

    local spec = self.spec_tensionBelts
    if Input.isKeyPressed(Input.KEY_r)
        
    end
but I don't know how to play a sound after that

Post Reply