ToonTank: Tank turret doesn't find mouse cursor

I’m at the end of lecture “144. Calling Override Functions” where my tank turret should be pointing to where my mouse cursor is, but for some reason the turret is pointing at the world origin instead.

I’ve created a UE_LOG to see what returns from TraceHitResult after GetHitResultUnderCursor().

UE_LOG(LogTemp, Warning, TEXT("TraceHitResult: %s"), *HitLocation.ToString());

Unfortunately I get zeros. I’ve also tried using GetMouseLocation()

float mouseX;                                                            
float mouseY;                                                            
PlayerControllerRef->GetMousePosition(mouseX, mouseY);                   
                                                                         
UE_LOG(LogTemp, Warning, TEXT("Mouse X: %f MouseY: %f"), mouseX, mouseY);

This also gives my zeros.

I also tried the Gitlab repository linked in a lecture’s Resources, but it gives me the same results.

My OS is Gentoo Linux, and my UE version is 4.26.2.

I solved it!

It turns out I needed to set CONFIG_INPUT_MOUSEDEV to Y, or M, in my Linux kernel configuration.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.