x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

C++ error to be fixed for skletle mesh

Being a noob at C++ I used "https://wiki.unrealengine.com/Animation_Blueprint,_Implement_Custom_C%2B%2B_Logic_Via_Tick_Updates" by Rama to get skeletal components to operate on my C++ pawn so I could add a skeletal mesh. The problem is that being a noob I have no idea about how to fix the following errors.

On the C++ source file line 42, 45, 93 and 96, UGHFF and Super: name followed by '::' must be a class or name space name. Line 48 "OwningPawn" and "TryGetPawnOwner" is undefined. Line 99: "OwningPawn" is undefined. Line 105: IsMoving is undefined. This is the screen shot to the header file.alt text

// Fill out your copyright notice in the Description page of Project Settings.

include "The_Last_Bat.h"

include "GHFF.h"

// Sets default values. AGHFF::AGHFF() { // Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true;

 // Creates our root component that is our scene component.
 RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComponent"));
 // Create our springarm component.
 SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArmComponent"));
 // Attach the spring arm component to our root component.
 SpringArm->AttachTo(RootComponent);
 // Set up our spring arm direction maths.
 SpringArm->SetRelativeLocationAndRotation(FVector(0.f, 0.f, 0.f), FRotator(0.f, 0.f, 0.f));
 // Creates first poson effect.
 SpringArm->TargetArmLength = 0.f;
 // Lag the camera for a certan head movement speed.
 SpringArm->bEnableCameraLag = true;
 // This leaves the max speed the player can turn the bats head.
 SpringArm->CameraLagSpeed = 1000.f;
 // We want the camera to be compleatly independant with the head. So the player can see most directions with out turning.
 SpringArm->bUsePawnControlRotation = false;
 // Creates our camera component.
 Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
 // Attachers the camera component to the spring arm component.
 Camera->AttachTo(SpringArm, USpringArmComponent::SocketName);

 // Set up values.
 CurrentPitchSpeed = 0.f;
 CurrentYawSpeed = 0.f;
 CurrentRollSpeed = 0.f;
 CurrentForwardSpeed = 50.f;

}

//This function is like PostInitAnimtree in UE3 void UGHFF::NativeInitializeAnimation() { //Very Important Line Super::NativeInitializeAnimation();

 //Cache the owning pawn for use in Tick
 OwningPawn = TryGetPawnOwner();

}

// Called when the game starts or when spawned. void AGHFF::BeginPlay() { Super::BeginPlay(); }

// Called every frame. void AGHFF::Tick(float DeltaTime) { Super::Tick(DeltaTime);

 // Calculate change in rotation this frame.
 FRotator DeltaRotation(0, 0, 0);
 // Calculate change in rotation this frame.
 DeltaRotation.Pitch = CurrentPitchSpeed * DeltaTime;
 // Calculate change in rotation this frame.
 DeltaRotation.Yaw = CurrentYawSpeed * DeltaTime;
 //Calculate change in rotation this frame.
 DeltaRotation.Roll = CurrentRollSpeed * DeltaTime;
 // Rotate GHFF.
 AddActorLocalRotation(DeltaRotation);

 // Rolls our player with the camera.
 FRotator NewRotation = GetActorRotation();
 NewRotation.Roll += CameraInput.Z;
 SetActorRotation(NewRotation);

 // Handle movement inputs.
 {
     if (!PlayerInput.IsZero())
     {
         PlayerInput = PlayerInput.GetSafeNormal() * 100.f;
         FVector NewLocation = GetActorLocation();
         NewLocation += GetActorForwardVector() * PlayerInput.X * DeltaTime;
         NewLocation += GetActorRightVector() * PlayerInput.Y * DeltaTime;
         NewLocation += GetActorUpVector() * PlayerInput.Z * DeltaTime;
         SetActorLocation(NewLocation);
     }
 }

}

//Tick void UGHFF::NativeUpdateAnimation(float DeltaTimeX) { //Very Important Line Super::NativeUpdateAnimation(DeltaTimeX);

 //Always Check Pointers
 if (!OwningPawn)
 {
     return;
 }

 //Set whether moving or not
 IsMoving = (OwningPawn->GetVelocity().SizeSquared() > 25);

}

// Called to bind functionality to input. void AGHFF::SetupPlayerInputComponent(class UInputComponent* InputComponent) { Super::SetupPlayerInputComponent(InputComponent);

 // Checks there is a input component.
 check(InputComponent);

 // Gets mouse movement for camera pitch.
 InputComponent->BindAxis("CameraPitch", this, &AGHFF::PitchCamera);
 // Gets mouse movement for camera yaw.
 InputComponent->BindAxis("CameraYaw", this, &AGHFF::YawCamera);

 // Gets the keyboard for moveing the player left and right.
 InputComponent->BindAxis("MoveRight", this, &AGHFF::MoveRight);
 // Gets the keyboard for moveing the player foward and hovering.
 InputComponent->BindAxis("MoveFoward", this, &AGHFF::MoveFoward);

 // Gets the mouse for changeing the altitude.
 InputComponent->BindAxis("MoveUp", this, &AGHFF::MoveUp);

}

// Called to bind functionality to input. void AGHFF::PitchCamera(float AxisValue) { CameraInput.Y = AxisValue; }

// Called to bind functionality to input. void AGHFF::YawCamera(float AxisValue) { CameraInput.X = AxisValue; }

// Called to bind functionality to input. void AGHFF::RollCamera(float AxisValue) { CameraInput.Z = AxisValue; }

// Called to bind functionality to input. void AGHFF::MoveUp(float AxisValue) { PlayerInput.X = FMath::Clamp(AxisValue, 1.0f, -1.0f); }

// Called to bind functionality to input. void AGHFF::MoveRight(float AxisValue) { PlayerInput.Y = FMath::Clamp(AxisValue, 1.0f, -1.0f); }

// Called to bind functionality to input. void AGHFF::MoveFoward(float AxisValue) { PlayerInput.Z = FMath::Clamp(AxisValue, 1.0f, -1.0f); }

Product Version: UE 4.9
Tags:
screenshot (66).png (105.3 kB)
more ▼

asked Dec 23 '15 at 02:44 AM in C++ Programming

avatar image

1999
143 7 6 7

avatar image 1999 Jan 09 '16 at 08:43 PM

I will be seeing if there is an answer to this question some where in the next holidays or I will be forced to go to war. 26 views when I posted this comment.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

It is a shame to have to do this to you, but I have managed to get this far on Blueprints. Should I continue on Blueprints or not? alt text

screenshot (67).png (178.2 kB)
more ▼

answered Jan 23 '16 at 05:15 AM

avatar image

1999
143 7 6 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

So what it seems to me is the class AGHFF is trying to override two functions that don't exist in a parent class. Without seeing the whole header from the first image, my only guess is this class doesn't implement UAnimInstance like the tutorial does. If it does, could you update the original question with the full header for AGHFF?

more ▼

answered Jan 10 '16 at 02:15 AM

avatar image

BenniKane
21 1 4 4

avatar image 1999 Jan 17 '16 at 09:29 PM
 // Fill out your copyright notice in the Description page of Project Settings.
 
 #pragma once
 
 #include "GameFramework/Pawn.h"
 #include "GHFF.generated.h"
 
 UCLASS(transient, Blueprintable, hideCategories = AnimInstance, BlueprintType)
 class THE_LAST_BAT_API AGHFF : public APawn
 {
     GENERATED_BODY()
 
 public:
     // Sets default values for this pawn's properties.
     AGHFF();
 
     // Called when the game starts or when spawned.
     virtual void BeginPlay() override;
     
     // Called every frame.
     virtual void Tick( float DeltaSeconds ) override;
 
     // Called to bind functionality to input.
     virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
 
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = GHFF)
         // Sets up the camera spring arm for the player to pan around.
         USpringArmComponent* SpringArm;
         // Sets up the camera for the player to see the world and move around.
         UCameraComponent* Camera;
 
     // Sets up 3 input varibles for the player when flying or roosting.
     FVector PlayerInput;
     // Sets up our camera 3 direvtions it can turn in.
     FVector CameraInput;
 
     // Sets up the maths for the players camera pitch.
     void PitchCamera(float AxisValue);
     // Sets up the maths for the players camera yaw.
     void YawCamera(float AxisValue);
     // Sets up the maths for the players camera roll.
avatar image 1999 Jan 17 '16 at 09:33 PM
         void RollCamera(float AxisValue);
         // Sets up the maths for the players altitude value.
         void MoveUp(float AxisValue);
         // Sets up the maths for the players turing value.
         void MoveRight(float AxisValue);
         // Sets up the maths for the players turing value.
         void MoveFoward(float AxisValue);
         // Sets up for when the player hovers.
         void Hover();
     
         /** Is Moving */
         UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement)
             bool IsMoving;
     
         // Sets what the player role rate currently is.
         UPROPERTY(EditAnywhere, Category = MoveFoward)
             float CurrentRollSpeed;
         // Sets what the player yaw rate currently is.
         UPROPERTY(EditAnywhere, Category = MoveUp)
             float CurrentYawSpeed;
         // Sets what the player pitch rate currently is.
         UPROPERTY(EditAnywhere, Category = MoveRight)
             float CurrentPitchSpeed;
         // Sets the rate the player is currently moveing foward.
         UPROPERTY(EditAnywhere, Category = MoveFoward)
             float CurrentForwardSpeed;
     
         //init and tick
         APawn * OwningPawn;
         virtual void NativeInitializeAnimation() override;
         virtual void NativeUpdateAnimation(float DeltaTimeX) override;
     };


The problem is that I set this up as a "Pawn" and "Rama" has set this up as a "AnimInstance" If this is one of the things I need to fix then I will. Any change will cause another problem to the script.

avatar image 1999 Jan 19 '16 at 09:52 PM

Do I need to change from a "Pawn" to a "AnimInstance" and if I need this to be "Pawn" how do I keep "class THE_LAST_BAT_API AGHFF : public APawn" to be a pawn when it may need to be changed to something else?

avatar image 1999 Jan 22 '16 at 09:50 AM

// Fill out your copyright notice in the Description page of Project Settings.

pragma once

include "GameFramework/Pawn.h"

include "GHFF.generated.h"

UCLASS(transient, Blueprintable, hideCategories = AnimInstance, BlueprintType) class THE_LAST_BAT_API AGHFF : public UAnimInstance { GENERATED_BODY()

public:

 AGHFF();

 // Called when the game starts or when spawned.
 virtual void BeginPlay();

 // Called every frame.
 virtual void Tick(float DeltaSeconds);

 // Called to bind functionality to input.
 virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent);

 // Is Moving.
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement)
     bool IsMoving;

 // Sets default values for this pawn's properties.
 AGHFF * OwningPawn;

//init and tick public:

 APawn * OwningPawn;

 virtual void NativeInitializeAnimation() override;

 virtual void NativeUpdateAnimation(float DeltaTimeX) override;

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = GHFF)
     // Set up a component for everything to attach to.
     USceneComponent* RootComponent;
     // Sets up the camera spring arm for the player to pan around.
     USpringArmComponent* SpringArm;
     // Sets up the camera for the player to see the world and move around.
     UCameraComponent* Camera;

 // Sets up 3 input varibles for the player when flying or roosting.
 FVector PlayerInput;
 // Sets up our camera 3 direvtions it can turn in.
 FVector CameraInput;
avatar image 1999 Jan 22 '16 at 09:54 AM
 // Sets up the maths for the players camera pitch.
 void PitchCamera(float AxisValue);
 // Sets up the maths for the players camera yaw.
 void YawCamera(float AxisValue);
 // Sets up the maths for the players camera roll.
 void RollCamera(float AxisValue);
 // Sets up the maths for the players altitude value.
 void MoveUp(float AxisValue);
 // Sets up the maths for the players turing value.
 void MoveRight(float AxisValue);
 // Sets up the maths for the players turing value.
 void MoveFoward(float AxisValue);
 // Sets up for when the player hovers.
 void Hover();

 /** Is Moving */
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement)
     bool IsMoving;

 // Sets what the player role rate currently is.
 UPROPERTY(EditAnywhere, Category = MoveFoward)
     float CurrentRollSpeed;
 // Sets what the player yaw rate currently is.
 UPROPERTY(EditAnywhere, Category = MoveUp)
     float CurrentYawSpeed;
 // Sets what the player pitch rate currently is.
 UPROPERTY(EditAnywhere, Category = MoveRight)
     float CurrentPitchSpeed;
 // Sets the rate the player is currently moveing foward.
 UPROPERTY(EditAnywhere, Category = MoveFoward)
     float CurrentForwardSpeed;

};

The two comments on top are the changers I have made to the header file. Please see the third last comment. The errors I am getting are all source file errors next comment.

avatar image 1999 Jan 22 '16 at 09:54 AM
 1    IntelliSense: name followed by '::' must be a class or namespace name    c:\Users\Daniel\Documents\Unreal Projects\The_Last_Bat\Source\The_Last_Bat\GHFF.cpp    82
 2    IntelliSense: name followed by '::' must be a class or namespace name    c:\Users\Daniel\Documents\Unreal Projects\The_Last_Bat\Source\The_Last_Bat\GHFF.cpp    85
 3    IntelliSense: identifier "OwningPawn" is undefined    c:\Users\Daniel\Documents\Unreal Projects\The_Last_Bat\Source\The_Last_Bat\GHFF.cpp    88
 4    IntelliSense: identifier "TryGetPawnOwner" is undefined    c:\Users\Daniel\Documents\Unreal Projects\The_Last_Bat\Source\The_Last_Bat\GHFF.cpp    88
 5    IntelliSense: name followed by '::' must be a class or namespace name    c:\Users\Daniel\Documents\Unreal Projects\The_Last_Bat\Source\The_Last_Bat\GHFF.cpp    96
 6    IntelliSense: name followed by '::' must be a class or namespace name    c:\Users\Daniel\Documents\Unreal Projects\The_Last_Bat\Source\The_Last_Bat\GHFF.cpp    99
 7    IntelliSense: identifier "OwningPawn" is undefined    c:\Users\Daniel\Documents\Unreal Projects\The_Last_Bat\Source\The_Last_Bat\GHFF.cpp    102
 8    IntelliSense: identifier "IsMoving" is undefined    c:\Users\Daniel\Documents\Unreal Projects\The_Last_Bat\Source\The_Last_Bat\GHFF.cpp    108
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question