My code directly returns an ASprungWheel*
instead of an AActor*
, and hence my implementation of GetWheels()
is
TArray<ASprungWheel*> UTankTrack::GetWheels() const
{
TArray<USceneComponent*> Children;
GetChildrenComponents(true, Children);
TArray<ASprungWheel*> Wheels;
for (USceneComponent* Child : Children)
{
USuspensionSpawnPoint* SpawnPoint = Cast<USuspensionSpawnPoint>(Child);
if (SpawnPoint != nullptr)
{
Wheels.Add(SpawnPoint->GetWheel());
}
}
return Wheels;
}
I also removed SetThrottle()
by moving the call to FMath::Clamp()
into DriveTrack()
.
@sampattuzzi thanks for the extra course content, I believe a discourse on Physics Constraints is essential for several areas in game development involving physical realism and simulations, and I appreciate the added effort in clarifying the topic in the simplest way possible.