Foremost, I am attempting to teach myself what I can with C# on my spare time. I have had very minimal instruction on C# coding thus far (via Udemy), but am also attempting to practice what I can based on examples. I have become comfortable with posting events with code, and am trying to graduate up to controlling RTPC's with code.
Essentially, I have a Blend Container set up in Wwise, with five different engine loops at various RPMs, each with slight graduating pitch. In Unity, I am using the Car from the Standard Assets as my test subject. Additionally in Unity, I started a new script on the vehicle controller, and am successfully starting the engine with a PostEvent, like so:
-----------------------------------------------------------------------------
public class Engine : MonoBehaviour {
private string StartEngine = "Engine"
void Start () {
AkSoundEngine.RegisterGameObj(gameObject);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
AkSoundEngine.PostEvent(StartEngine, gameObject);
}
--------------------------------------------------------------------
Next, for calling my Game Sync / Parameter, "EngineRTPC" I know that I need something in the ballpark of this:
------------------------------------------------------------------------
{
AkSoundEngine.SetRTPCValue("EngineRTPC", gameObject);
}
---------------------------------------------------------------------
... but am stuck on what line of code I need above that to attach to the speed of the vehicle.
I have tried various combinations, with GetSpeed, mathf, Vector3, float, GetComponent, velocity, etc; but fear I'm way in over my head, with seemingly what might be one line of code.
Any help and / or explanation would be most appreciated!