Announcement
Collapse
No announcement yet.
Training Stream - Tanks vs. Zombies, p.3 - May 17th
Collapse
X
-
ShiroiKuma repliedSolved, needed to go into RegularTurretBP and select the Missile from the dropdown under Projectiles. I swear that wasn't mentioned in the video.
-
ShiroiKuma repliedI've been following this series on Youtube (using 4.18.2) and have encountered a scenario I can't quite figure out yet.
It seems my Projectile check is always returning negative and hence my UE_LOG for the fire event isn't firing.
My turret.h contains the following:Code:protected: // Maximum turn rate in degrees/second for the turret. UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Turret") float YawSpeed; // Tank that owns this turret. UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Turret") ATank* Tank; // Projectile to spawn when firing. UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Turret") TSubclassOf<AActor> Projectile;
Code:const FTankInput& CurrentInput = Tank->GetCurrentInput(); if (CurrentInput.bFire1) { UE_LOG(LogTemp, Warning, TEXT("FIRE! 1")); } if (CurrentInput.bFire1 && Projectile) { UE_LOG(LogTemp, Warning, TEXT("FIRE! 2")); if (UWorld* World = GetWorld()) { UE_LOG(LogTemp, Warning, TEXT("FIRE! 3")); if (AActor* NewProjectile = World->SpawnActor(Projectile)) { FVector Loc = TurretSprite->GetSocketLocation("Muzzle"); FRotator Rot = TurretDirection->GetComponentRotation(); NewProjectile->SetActorLocation(Loc); NewProjectile->SetActorRotation(Rot); } } }
Leave a comment:
-
SausagesSizzling replied12-24-2017, 10:08 AMThanks for the tutorial, I know I am really late to the party but I'm hoping someone can still remember and help me get through my bottleneck. I am struggling to spawn a shell. In particular I can't figure out where the shell sprite was added.
On the video at 1:14 there doesn't seem to be any shell sprite in the blueprint but I have downloaded the C++ code and it is not in the Missile class either? I tried to add one in the construction script of RegularMissileBP and a few other things but none have worked.
Also at 1:14 there is a paper flipbook. I can make the flipbook but if I right click on the Blueprint then the only flipbook node available is AddPaperFlibookComponent. There is no SetFlipbook etc.
Thanks!Announce Post: https://forums.unrealengine.com/showthread.php?110887 Continuing the "Tanks" C++ stream, Richard and Lauren are making tanks to fight a zombie...
Leave a comment:
-
wasil12345 repliedI have strange error after editing top of Tank.h it is sometimes fixable by:
https://answers.unrealengine.com/que...***-error.html
but sometimes this solution do not workand I have to try random combination of it to work. Can anyone help?
Leave a comment:
-
InferniousRuler repliedWhich header file would we add this change? Would it be the Turret.h one or some other header file? This is regarding the reply you made to Freedom911.
Leave a comment:
-
Richard Hinckley repliedThanks, gseben, I understand what you mean now. Yes, there's some imprecision there, so checking the absolute value of delta against an epsilon would be a good idea to stop redundant rotator usage. To fix that, we'll use KINDA_SMALL_NUMBER as our epsilon. We'll also need to check if DeltaYaw is 180. To do this, we should replace this check:
Code:if (DeltaYaw != 0.0f)
Code:if (FMath::IsNearlyZero(DeltaYaw - 180.0f, KINDA_SMALL_NUMBER)) { bReverse = true; } else if (!FMath::IsNearlyZero(DeltaYaw, KINDA_SMALL_NUMBER))
Leave a comment:
-
Richard Hinckley repliedOriginally posted by Freedom911 View PostHello Everyone.I have updated my engine to 4.11 .I have an error in Turret.cpp file that ParentComponentActor is not declared.Also the page for ParentComponentActor has been removed from documentation.Any help?
Code:private: /** The Actor that owns the UChildActorComponent that owns this Actor. */ UPROPERTY() TWeakObjectPtr<AActor> ParentComponentActor_DEPRECATED; /** The UChildActorComponent that owns this Actor. */ UPROPERTY() TWeakObjectPtr<UChildActorComponent> ParentComponent;
Leave a comment:
-
FinalRockstar repliedHello Everyone.I have updated my engine to 4.11 .I have an error in Turret.cpp file that ParentComponentActor is not declared.Also the page for ParentComponentActor has been removed from documentation.Any help?
Leave a comment:
-
gseben repliedOriginally posted by Richard Hinckley View PostDo you mean that the tank will actually move the wrong direction, or that it will turn suboptimally when it's right on the line between turning right and turning left? Depending on what the effect is, there are cases in gameplay programming where I'm OK with fragility. Usually, in engine-level programming, I would be more strict about things like that, but if it's at a gameplay level and doesn't lead to a bad player experience, it's usually considered acceptable. So, the tank turning an extra 0.0000001 degrees by rotating the wrong way is OK, but the tank moving left when I press right or vibrating in place is not.
LogTemp:Warning: TankDirection->GetComponentRotation().Yaw, DesiredMovementDirection.Rotation().Yaw: (89.999992, 90.000000)
LogTemp:Warning: DeltaYaw, AdjustedDeltaYaw: (0.000008, 0.000008)
LogTemp:Warning: TankDirection->GetComponentRotation().Yaw, DesiredMovementDirection.Rotation().Yaw: (89.999992, 90.000000)
LogTemp:Warning: DeltaYaw, AdjustedDeltaYaw: (0.000008, 0.000008)
LogTemp:Warning: TankDirection->GetComponentRotation().Yaw, DesiredMovementDirection.Rotation().Yaw: (89.999992, 90.000000)
LogTemp:Warning: DeltaYaw, AdjustedDeltaYaw: (0.000008, 0.000008)
Trying to turn the tank by an additional 90 degrees results in:
LogTemp:Warning: TankDirection->GetComponentRotation().Yaw, DesiredMovementDirection.Rotation().Yaw: (89.999992, 180.000000)
LogTemp:Warning: DeltaYaw, AdjustedDeltaYaw: (90.000008, -89.999992)
Note how AdjustedDeltaYaw becomes negative since the difference between the tank direction and the desired direction is slightly greater than 90 degrees. I'm not sure where this small error is coming from, and how reproducible it is, but it happens consistently for me.
Originally posted by Richard Hinckley View PostI would probably have gone with "always spawn" without the location adjustment, but the fact that it's moving you around is interesting, because that means it's detecting a collision, as you said, and we don't deliberately have any collision geometry on the tank, or the land, for that matter. Maybe we need to go through the sprite components that we used to make the tank/turret/terrain and double-check that collision is turned off. That seems like it is the most probable cause of an issue like that.
Leave a comment:
-
UchihaKite repliedOriginally posted by Lauren Ridge View PostHi UchihaKite! Right now, we're scheduled for 6/14 - hope to see you then!
Leave a comment:
-
Shadow.Storm repliedHi UchihaKite! Right now, we're scheduled for 6/14 - hope to see you then!
Leave a comment:
-
UchihaKite repliedHopefully I do not come off the wrong way, because I do not mean this in a rushing or negative way, but I was wondering if their happens to be an estimated time of Part 4 of the stream? In my Game Prototyping Class, along with my group assignment, I am following a long a tutorial series and have to turn that in, in two weeks. Doesn't have to be completed, just have to do as much as I can, so I am just curious as to when the next part isSorry if I am not allowed to ask this!
Leave a comment:
-
Richard Hinckley repliedOriginally posted by TheDuke View PostBelow is the error I'm still getting (I had added the AMissile to the project). Its this line that its not happy about...if(AMissile*NewProjectile = World->SpawnActor(Projectile))
Leave a comment:
-
Richard Hinckley repliedOriginally posted by gseben View PostFirst of all, thank you for doing this stream series. You and Lauren have done a fantastic job explaining Unreal's C++ API.
Originally posted by gseben View Post1)
In your ATank::Tick method, in the part that handles the tank's rotation there is a small problem.
...
Float point precision errors make these comparisons fragile. For example, when the AdjustedDeltaYaw is 90, but the float representation is slightly off (90.0000001) the tank will move in the opposite direction. We need tolerance bounds to solve the issue.
Originally posted by gseben View Post2)
To fix the issue with TankBP not spawning at PlayerStart, I had to change the "Spawn Collision Handling Method" of TankBP to "Try To Adjust Location, But Always Spawn". But I couldn't figure out what I was colliding with. Do you know what is happening?
Leave a comment:
Leave a comment: