• Breaking News

    Toggle LookAround for 3person like in PUBG, C++ Unreal Hey everyone, I am trying to create a toggle for my CameraBoom "SpringArmComponent", which has a FollowCamera. I've used the code>>>> bUseControllerRotationYaw = false; <<<<< to allow this to work in a function, but this only works when the key or mouse button is pressed and held which is what i want for the "ToggleOn". I want the camera to move to the back of the character when the Key is released, exactly the same as you see in other 3rd person games, especially pubg. Here is my code so you see what i am dealing with. The bUseControllerRotationYaw = true; found below needs to be there to correct the camera's viewing functionality, but this code also causes the character to spin sharply. void AFI_MainCharacter::ViewingRotationToggleOn() { // Don't rotate when the controller rotates. Let that just affect the camera. bUseControllerRotationYaw = false; } void AFI_MainCharacter::ViewingRotationToggleOff() { // find out which way is forward const FRotator Rotation = GetActorRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get forward vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X); CameraBoom->SetRelativeRotation(YawRotation, false, nullptr, ETeleportType::ResetPhysics); CameraBoom->SetRelativeLocation(Direction, false, nullptr, ETeleportType::ResetPhysics); bUseControllerRotationYaw = true; } Here is a link to my facebook Dev Page, to a video showing the current effect. You will first see me move the camera as normal then i will "Click my middle mouse button and hold it" this shows the Lookaround mechanic. You will notice when i let go of the "Middle Mouse button" the character does a sharp spin. I just want the cameraboom and followcamera that is attached to spin around so the camera faces the back of the character. I want to move the camera to the original position not have the character move the way it currently does. My Question is, What code can i use for the ToggleOff, so my cameraboom rotates back to it's original postion???? Please help, I appreciate all the feedback, input, and advice i can get. Thankyou for your time, much appreciations. https://ift.tt/eA8V8J

    Hey everyone, I am trying to create a toggle for my CameraBoom "SpringArmComponent", which has a FollowCamera. I've used the code>>>> bUseControllerRotationYaw = false; <<<<< to allow this to work in a function, but this only works when the key or mouse button is pressed and held which is what i want for the "ToggleOn". I want the camera to move to the back of the character when the Key is released, exactly the same as you see in other 3rd person games, especially pubg. Here is my code so you see what i am dealing with. The bUseControllerRotationYaw = true; found below needs to be there to correct the camera's viewing functionality, but this code also causes the character to spin sharply. void AFI_MainCharacter::ViewingRotationToggleOn() { // Don't rotate when the controller rotates. Let that just affect the camera. bUseControllerRotationYaw = false; } void AFI_MainCharacter::ViewingRotationToggleOff() { // find out which way is forward const FRotator Rotation = GetActorRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get forward vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X); CameraBoom->SetRelativeRotation(YawRotation, false, nullptr, ETeleportType::ResetPhysics); CameraBoom->SetRelativeLocation(Direction, false, nullptr, ETeleportType::ResetPhysics); bUseControllerRotationYaw = true; } Here is a link to my facebook Dev Page, to a video showing the current effect. You will first see me move the camera as normal then i will "Click my middle mouse button and hold it" this shows the Lookaround mechanic. You will notice when i let go of the "Middle Mouse button" the character does a sharp spin. I just want the cameraboom and followcamera that is attached to spin around so the camera faces the back of the character. I want to move the camera to the original position not have the character move the way it currently does. My Question is, What code can i use for the ToggleOff, so my cameraboom rotates back to it's original postion???? Please help, I appreciate all the feedback, input, and advice i can get. Thankyou for your time, much appreciations.

    from GameDev.net https://ift.tt/2OFygzX

    ليست هناك تعليقات

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728