I’ve finished slide 224 (Solution: Implement Get Wheels) and started having Spawning Issues. This is the error log I am getting. Any help would be greatly appreciated. Thanks
Could you post your code please?
Hi Dan, I’ve tried copying and pasting my code via Snipping Tool but it dosen’t seem to do a good job. For some reason it turns the picture into an actual code file. When you try opening the file, it has a bunch of non-sense written on it. Is there any other way I can send you my code directly? I’m not sure how to do that. Thank you.
Hi Dan, I managed to get the game working properly! I don’t know what went wrong but you were right. It was related to my Code. I’ll get back to you soon with an Update of what I did wrong with my Code. Thank you again Dan, and have a wonderful day!
You can just copy and paste it and then highlight the code and press the </>
button.
Awesome Dan, I’m play testing it as we speak. No more issues! The only problem I have now is that the Tank’s suspension is a bit off. As I accelerate, the front or rear lifts from the Tank. What can I do to make the Tank more planted on the floor? Thank you again Dan.
Sorry about the last question. I went all the way to the end of the video and saw that this is a normal problem. I think it will get solved on the next slide or so. Thank you again Dan, and have a wonderful day.
Are you saying the front lifts up when you go forwards and the back goes up when you reverse? Because that’s what I would expect to happen.
Yup, you’re right and I hope this physics issue gets resolved soon. Ok, I found what went wrong with my code. I found the error under my SpawnPoint.cpp file. I fogot to add “SpawnedActor” pointer to the following line of code in BeginPlay.
Below is what the code should look like.
SpawnedActor->AttachToComponent(this,
FAttachmentTransformRules::KeepWorldTransform);
I also provided what my code actually looked like below.
Thank you again Dan. God Bless.
#include “BattleTank.h”
#include “SpawnPoint.h”
// Sets default values for this component’s properties
USpawnPoint::USpawnPoint()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don’t need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void USpawnPoint::BeginPlay()
{
Super::BeginPlay();
SpawnedActor = GetWorld()->SpawnActorDeferred<AActor>(SpawnClass, GetComponentTransform());
if (!SpawnedActor) { return; }
AttachToComponent(this, FAttachmentTransformRules::KeepWorldTransform);
UGameplayStatics::FinishSpawningActor(SpawnedActor, GetComponentTransform());
}
// Called every frame
void USpawnPoint::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// …
}
I was actually talking about a real world tank. Unless you mean it lifts up a lot with little acceleration.