Download

How to use UWheeledVehicleMovementComponent via UBlueprintFunctionLibrary

Hi,
I have a problem with engine torque curve not working under blueporint version of wheeledVehicle class.
Have been trying to workaround this problem by calling blueprint function library from blueprint , giving pointer to wheeledVehicle and setting torque curve parameters via code.
But code fails to compile.
How to set up include files and function for wheeledVehicle to compile the blueprint function sucessfully?


// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "carTorque.generated.h"

//#include "WheeledVehicleMovementComponent.h"


/**
 *
 */



UCLASS()
class TESTCAR_API UcarTorque : public UBlueprintFunctionLibrary
{
    GENERATED_BODY()

        UFUNCTION(BlueprintCallable, Category = "Custom")
        static void setTorqueCurve(float RPM,float power, UWheeledVehicleMovementComponent * vehicle);
        static void cleanTorqueCurve(UWheeledVehicleMovementComponent * vehicle);

};



There appears to be 2 year old thread also with same issue: Torque Curve Broken - UE4 AnswerHub

What are the compile errors? Try to provide as much information as possible - you will get help faster.

Compiling problem occurs if adding (UWheeledVehicleMovementComponent * vehicle) as function input.

Overall idea is to try workaround the torque curve problem in blueprint version of vehicle example using:
EngineSetup.TorqueCurve.GetRichCurve()->Reset() and EngineSetup.TorqueCurve.GetRichCurve()->AddKey();
functions like are used and working in the c++ version of vehicle example.



1>------ Build started: Project: testCar, Configuration: Development_Editor x64 ------
1>Compiling game modules for hot reload
1>Target Platform -- Win64
1>Parsing headers for testCarEditor
1>  Running UnrealHeaderTool "D:	estCarFiles 4.10	estCar 10.05	estCar.uproject" "D:	estCarFiles 4.10	estCar 10.05\Intermediate\Build\Win64	estCarEditor\Development	estCarEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
1>Reflection code generated for testCarEditor in 6,30509 seconds
1>Performing 5 actions (9 in parallel)
1>carTorque.cpp
1>testCar.init.gen.cpp
1>carTorque.gen.cpp
1>D:	estCarFiles 4.10	estCar 10.05\Intermediate\Build\Win64\UE4Editor\Inc	estCar\carTorque.gen.cpp(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:	estCarFiles 4.10	estCar 10.05\Intermediate\Build\Win64\UE4Editor\Inc	estCar\carTorque.gen.cpp(19): error C2146: syntax error: missing ';' before identifier 'UClass'
1>D:	estCarFiles 4.10	estCar 10.05\Intermediate\Build\Win64\UE4Editor\Inc	estCar\carTorque.gen.cpp(44): error C3861: 'Z_Construct_UClass_UWheeledVehicleMovementComponent_NoRegister': identifier not found
1>ERROR : UBT error : Failed to produce item: D:	estCarFiles 4.10	estCar 10.05\Binaries\Win64\UE4Editor-testCar-8049.dll
1>Total build time: 14,33 seconds (Local executor: 0,00 seconds)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command ""C:\Program Files\Epic Games\UE_4.17\Engine\Build\BatchFiles\Build.bat" testCarEditor Win64 Development "D:	estCarFiles 4.10	estCar 10.05	estCar.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project "testCar.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========




Managed to get includes right and compile , unfortunately entering torque, max engine rpms or other parameters to the vehicle instance pointed to by blueprint didnot change anything during runtime.
Maybe something done wrong or there is another vehicle instance that the game uses instead.
What other ways to try to fix the torque problem?