Download

Many questions

Hello,

so my trial period for the Visual Studio ended, and even that i know absolutely nothing about programming, i must say… it was kinda interesting/fun month.
I decided to recreate my blueprints to C++… some things were easy, others were not. And i would like to make the “difficult ones” to work, finish what i started, atleast.

Thats why i decided to create this topic, but i must warn you … the list will be probably long.

  1. With this function:

void AMyCharacter::TurnAround(float AxisRate)
	{
	   if (AxisRate != 0.f && InputComponent->GetAxisValue("MoveForward") == 0.f && InputComponent->GetAxisValue("MoveRight") == 0.f)
	   {
	       // Cancel MouseClick Move
	       Controller->StopMovement();
	       //
	       AddControllerYawInput(AxisRate * BaseTurnAroundRate * GetWorld()->GetDeltaSeconds());
	       const FRotator NewActorRotation(0.f, AxisRate * BaseTurnAroundRate * GetWorld()->GetDeltaSeconds(), 0.f);
	       AddActorLocalRotation(NewActorRotation);
	   }  
	}

I want my character to turn together with the camera, preferably with the walk animation. Unfortunately these two functions (AddControllerYawInput, AddActorLocalRotation) won't work together, they only work solo. :(

Can this piece of code work?

GetCharacterMovement()->UpdateBasedRotation()

  1. Don’t you know for what these settings are for? I tried to turn these on and off, and i didn’t noticed any difference.

GetCharacterMovement()->bConstrainToPlane = true;
	GetCharacterMovement()->bSnapToPlaneAtStart = true;

  1. With my functions that control the camera:

void AMyCharacter::RotateCamera()
	{
	//UGameViewportClient::SetHideCursorDuringCapture(true);
	bCanRotateCamera = true;
	}
	void AMyCharacter::StopRotateCamera()
	{
	//GameViewportClient::SetHideCursorDuringCapture(false);
	bCanRotateCamera = false;
	}

Im trying to use SetHideCursorDuringCapture() to hide the cursor instead of the SetInputMode(FInputModeGameAndUI()) because i want to hide the cursor with RMB only… but i can’t reach it.

Also, i'm not even sure if this way will work in the first place.

That brings me to this piece code in the PlayerController that defines FInputModeGameAndUI()...

GameViewportClient.SetCaptureMouseOnClick(EMouseCaptureMode::CaptureDuringMouseDown);

you know… use CaptureDuringRightMouseDown instead of CaptureDuringMouseDown? But i am not sure how to do that right now :slight_smile:

  1. My project is based on TopDown template so my character moves with the mouse clicks and also with WSAD, that’s why i’m using Controller->StopMovement() so that WSAD can work…
    But i noticed that the character briefly freezes instead of just changing the direction… it’s quite visible. I might have way how to fix it, but again i can’t reach to the UPathFollowingComponent::AbortMove().
(I think that change from the FPathFollowingResultFlags::MovementStop to FPathFollowingResultFlags::UserAbort might work.)
  1. Is there a function similar to the SetViewTargetWithBlend(), that doesn’t use Actors (Cameras) but Rotation? To switch from one ControlRotation to another smoothly? I have few functions that are using different rotations (CameraSpringArm->bEnableCameraRotationLag serves as the smooth thing) but that doesnt work with the FirstPersonCamera (it doesn’t have the CameraSpringArm).
  2. Is it possible to rename the character’s default SkeletalMeshComponent? Or delete it?
  3. How to assign the material for the SpawnDecalAtLocation()?
  4. I have function in the PlayerController that uses MoveForward and MoveRight functions defined in the character. That function works in the blueprint because in the blueprint i can uncheck the “Consume Input”. How to not consume input in the code?

Thats probably all for now .)