Making 'showdebug' variables public?

Ok so when you type ‘showdebug vehicle’ you are presented with data about the tires, especially important is the tire long and lat slip but i cannot access these variables from blueprint :(.

Can I make that variable public for use in blueprint?
I have found the specific script within the Unreal files, and i have also found the specific variables(longSlip and latSlip), however making it public to view is what i need help with, I tried simply making the void function public but that didn’t seem to help :stuck_out_tongue:

I am currently looking at this code , as you can see there is the two varibles
const PxReal LatSlip = WheelsStates[w].lateralSlip;
const PxReal LongSlip = WheelsStates[w].longitudinalSlip;
but i cannot for the life of me find where WheelsStates[w] is set to make that public :frowning:


void UWheeledVehicleMovementComponent::DrawDebug(UCanvas* Canvas, float& YL, float& YPos)
{
	if (PVehicle == NULL)
	{
		return;
	}

	FPhysXVehicleManager* MyVehicleManager = GetWorld()->GetPhysicsScene()->GetVehicleManager();

	MyVehicleManager->SetRecordTelemetry(this, true);

	UFont* RenderFont = GEngine->GetSmallFont();
	// draw drive data
	{
		Canvas->SetDrawColor(FColor::White);
		float forwardSpeedKmH = GetForwardSpeed() * 3600.f / 100000.f;	//convert from cm/s to km/h
		YPos += Canvas->DrawText(RenderFont, FString::Printf(TEXT("Speed (km/h): %d"), (int32)forwardSpeedKmH), 4, YPos);
		YPos += Canvas->DrawText(RenderFont, FString::Printf(TEXT("Steering: %f"), SteeringInput), 4, YPos);
		YPos += Canvas->DrawText(RenderFont, FString::Printf(TEXT("Throttle: %f"), ThrottleInput), 4, YPos);
		YPos += Canvas->DrawText(RenderFont, FString::Printf(TEXT("Brake: %f"), BrakeInput), 4, YPos);
		YPos += Canvas->DrawText(RenderFont, FString::Printf(TEXT("RPM: %f"), GetEngineRotationSpeed()), 4, YPos);
		YPos += Canvas->DrawText(RenderFont, FString::Printf(TEXT("Gear: %d"), GetCurrentGear()), 4, YPos);
		YPos += Canvas->DrawText(RenderFont, FString::Printf(TEXT("Drag: %.3f"), DebugDragMagnitude), 4, YPos);

	}

	SCOPED_SCENE_READ_LOCK(MyVehicleManager->GetScene());
	PxWheelQueryResult* WheelsStates = MyVehicleManager->GetWheelsStates_AssumesLocked(this);
	check(WheelsStates);

	// draw wheel data
	for (uint32 w = 0; w < PVehicle->mWheelsSimData.getNbWheels(); ++w)
	{

		const PxMaterial* ContactSurface = WheelsStates[w].tireSurfaceMaterial;
		const PxReal TireFriction = WheelsStates[w].tireFriction;
		const PxReal LatSlip = WheelsStates[w].lateralSlip;
		const PxReal LongSlip = WheelsStates[w].longitudinalSlip;
		const PxReal WheelSpeed = PVehicle->mWheelsDynData.getWheelRotationSpeed(w) * PVehicle->mWheelsSimData.getWheelData(w).mRadius;

		UPhysicalMaterial* ContactSurfaceMaterial = ContactSurface ? FPhysxUserData::Get<UPhysicalMaterial>(ContactSurface->userData) : NULL;
		const FString ContactSurfaceString = ContactSurfaceMaterial ? ContactSurfaceMaterial->GetName() : FString(TEXT("NONE"));

		Canvas->SetDrawColor(FColor::White);

		Canvas->DrawText(RenderFont, FString::Printf(TEXT("%d]"), w), 4, YPos);

		Canvas->DrawText(RenderFont, FString::Printf(TEXT("LatSlip: %.3f"), LatSlip), YL * 4, YPos);
		Canvas->DrawText(RenderFont, FString::Printf(TEXT("LongSlip: %.3f"), LongSlip), YL * 12, YPos);
		Canvas->DrawText(RenderFont, FString::Printf(TEXT("Speed: %d"), (int32)WheelSpeed), YL * 22, YPos);
		Canvas->DrawText(RenderFont, FString::Printf(TEXT("Contact Surface: %s"), *ContactSurfaceString), YL * 74, YPos);
		if ((int32)w < Wheels.Num())
		{
			UVehicleWheel* Wheel = Wheels[w];
			Canvas->DrawText(RenderFont, FString::Printf(TEXT("Load: %.3f"), Wheel->DebugNormalizedTireLoad), YL * 30, YPos);
			Canvas->DrawText(RenderFont, FString::Printf(TEXT("Torque: %d"), (int32)Wheel->DebugWheelTorque), YL * 40, YPos);
			Canvas->DrawText(RenderFont, FString::Printf(TEXT("Long Force: %d"), (int32)Wheel->DebugLongForce), YL * 50, YPos);
			Canvas->DrawText(RenderFont, FString::Printf(TEXT("Lat Force: %d"), (int32)Wheel->DebugLatForce), YL * 62, YPos);
		}
		else
		{
			Canvas->DrawText(RenderFont, TEXT("Wheels array insufficiently sized!"), YL * 50, YPos);
		}

		YPos += YL;
	}

	// draw wheel graphs
	PxVehicleTelemetryData* TelemetryData = MyVehicleManager->GetTelemetryData_AssumesLocked();

	if (TelemetryData)
	{
		const float GraphWidth(100.0f), GraphHeight(100.0f);

		int GraphChannels] = {
			PxVehicleWheelGraphChannel::eWHEEL_OMEGA,
			PxVehicleWheelGraphChannel::eSUSPFORCE,
			PxVehicleWheelGraphChannel::eTIRE_LONG_SLIP,
			PxVehicleWheelGraphChannel::eNORM_TIRE_LONG_FORCE,
			PxVehicleWheelGraphChannel::eTIRE_LAT_SLIP,
			PxVehicleWheelGraphChannel::eNORM_TIRE_LAT_FORCE,
			PxVehicleWheelGraphChannel::eNORMALIZED_TIRELOAD,
			PxVehicleWheelGraphChannel::eTIRE_FRICTION
		};

		for (uint32 w = 0; w < PVehicle->mWheelsSimData.getNbWheels(); ++w)
		{
			float CurX = 4;
			for (uint32 i = 0; i < ARRAY_COUNT(GraphChannels); ++i)
			{
				float OutX = GraphWidth;
				DrawTelemetryGraph(GraphChannels*, TelemetryData->getWheelGraph(w), Canvas, CurX, YPos, GraphWidth, GraphHeight, OutX);
				CurX += OutX + 10.f;
			}

			YPos += GraphHeight + 10.f;
			YPos += YL;
		}
	}

	DrawDebugLines();
}


This code is viewable at the directory
C:\Program Files (x86)\Epic Games\4.12\Engine\Source\Runtime\Engine\Private\Vehicles\WheeledVehicleMovementComponent

Ok so i think I have made some progress but i still cannot access the variable through blueprint,
I have changed WheeledVehicleMovementComponent script,
In the .h version i have added.


	/** Get The Long Slip */
	UFUNCTION(BlueprintCallable, Category = "Game|Components|WheeledVehicleMovement")
	float GetWheelLongSlip();


and i have also added the .cpp file to include


float UWheeledVehicleMovementComponent::GetWheelLongSlip() const
{
	return WheelsStates[w].longitudinalSlip;
}

But i simply cannot see the function/variable in blueprint.
If any1 has any suggestions that wouuld be great :stuck_out_tongue:

Are you using a source build of the engine, and have ensured you’ve rebuilt it after your change? What you’ve shown should work. You should really use BlueprintPure instead of BlueprintCallable here, but that won’t change whether or not it shows up.

ah clearly i didnt put enough research in before attempting this :stuck_out_tongue: I am using the standard version of Unreal.

I found these links, i guess its the source version you are talking about?
https://docs.unrealengine.com/latest/INT/GettingStarted/DownloadingUnrealEngine/index.html
https://docs.unrealengine.com/latest/INT/Programming/Development/BuildingUnrealEngine/

I will get back to this post and let you know how it goes.

Got it working, was my fault :stuck_out_tongue:

@StonedRhino @kamrann I want to find the calculation for the forwardspeed and all other variables that are defined for the Wheeled Vehicle. Is that possible?