I am quite confused about this. I created a UObject class and I can’t access the properties in the Animation Blueprint, but I can access them in the blueprint for the UObject. I tried to create an instance of it but for some reason I can’t get it to work. I have searched for information on this and found that there was a function called ConstructObject this did not work. I want to call this class at regular intervals. I know how to rotate the bones.
I have A class partially made I’m not worried about conecting to it I just want to get it to work first.
this is my header
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "MyAnimator.generated.h"
UCLASS(Blueprintable)
class TRAIN_EVA1_API UMyAnimator : public UObject
{
GENERATED_BODY()
public:
UMyAnimator();
float muscleGroups[200];
float tension;
UPROPERTY(BlueprintReadWrite, Category = "MyVars")
float myDeltaTime;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thigh_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thigh_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thigh_r_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shin_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shin_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float foot_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float foot_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thigh_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thigh_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thigh_r_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shin_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shin_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float foot_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float foot_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine1_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine1_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine1_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine2_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine2_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine2_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine3_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine3_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine3_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine4_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine4_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine4_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine5_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine5_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine5_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine6_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine6_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine6_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine7_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine7_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine7_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine8_f;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine8_s;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float spine8_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float eyes_lr;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float eyes_ud;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shoulder_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shoulder_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shoulder_r_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float upperarm_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float upperarm_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float forarm_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float forarm_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float forarm_r_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float hand_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float hand_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float hand_r_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float palm_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float index_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float middle_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float ring_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float pinky_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float index_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float middle_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float ring_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float pinky_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float index1_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float middle1_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float ring1_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float pinky1_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb__s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb1_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb_s_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb2_f_l;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shoulder_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shoulder_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float shoulder_r_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float upperarm_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float upperarm_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float forarm_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float forarm_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float forarm_r_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float hand_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float hand_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float hand_r_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float palm_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float index_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float middle_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float ring_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float pinky_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float index_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float middle_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float ring_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float pinky_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float index1_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float middle1_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float ring1_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float pinky1_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb__s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb1_f_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb_s_r;
UPROPERTY(BlueprintReadOnly, Category = "MyMovement")
float thumb2_f_r;
UFUNCTION(BlueprintCallable, Category = "MyFunctions")
void updateRotation();
private:
float rotationLimit_pos[100];
float rotationLimit_neg[100];
float currentRotation[100];
float rotation_speed[100];
};
and this is my source
#include "MyAnimator.h"
UMyAnimator::UMyAnimator() {
for (int i = 0; i < 200; i++) {
muscleGroups[i] = 0;
}
}
void UMyAnimator::updateRotation() {
float tadd = 0;
float mysign;
for (int i = 0; i < 200; i += 2) tadd += muscleGroups[i] * muscleGroups[i + 1];
tension = tadd;
for (int i = 0; i < 200; i += 2) {
mysign = muscleGroups[i] - muscleGroups[i + 1];
if (mysign != 0) {
if (mysign > 0) {
if (currentRotation[int(i / 2)] < rotationLimit_pos[int(i / 2)]) currentRotation[int(i / 2)] += myDeltaTime * rotation_speed[int(i / 2)] * mysign;
}
else {
if (currentRotation[int(i / 2)] > rotationLimit_neg[int(i / 2)]) currentRotation[int(i / 2)] += myDeltaTime * rotation_speed[int(i / 2)] * mysign;
}
}
}
thigh_f_l = currentRotation[0];
thigh_s_l = currentRotation[1];
thigh_r_l = currentRotation[2];
shin_f_l = currentRotation[3];
shin_s_l = currentRotation[4];
foot_f_l = currentRotation[5];
foot_s_l = currentRotation[6];
thigh_f_r = currentRotation[7];
thigh_s_r = currentRotation[8];
thigh_r_r = currentRotation[9];
shin_f_r = currentRotation[10];
shin_s_r = currentRotation[11];
foot_f_r = currentRotation[12];
foot_s_r = currentRotation[13];
spine_f = currentRotation[14];
spine_s = currentRotation[15];
spine_r = currentRotation[16];
spine1_f = currentRotation[17];
spine1_s = currentRotation[18];
spine1_r = currentRotation[19];
spine2_f = currentRotation[20];
spine2_s = currentRotation[21];
spine2_r = currentRotation[22];
spine3_f = currentRotation[23];
spine3_s = currentRotation[24];
spine3_r = currentRotation[25];
spine4_f = currentRotation[26];
spine4_s = currentRotation[27];
spine4_r = currentRotation[28];
spine5_f = currentRotation[29];
spine5_s = currentRotation[30];
spine5_r = currentRotation[31];
spine6_f = currentRotation[32];
spine6_s = currentRotation[33];
spine6_r = currentRotation[34];
spine7_f = currentRotation[35];
spine7_s = currentRotation[36];
spine7_r = currentRotation[37];
spine8_f = currentRotation[38];
spine8_s = currentRotation[39];
spine8_r = currentRotation[40];
eyes_lr = currentRotation[41];
eyes_ud = currentRotation[42];
shoulder_f_l = currentRotation[43];
shoulder_s_l = currentRotation[44];
shoulder_r_l = currentRotation[45];
upperarm_f_l = currentRotation[46];
upperarm_s_l = currentRotation[47];
forarm_f_l = currentRotation[48];
forarm_s_l = currentRotation[49];
forarm_r_l = currentRotation[50];
hand_f_l = currentRotation[51];
hand_s_l = currentRotation[52];
hand_r_l = currentRotation[53];
palm_l = currentRotation[54];
index_s_l = currentRotation[55];
middle_s_l = currentRotation[56];
ring_s_l = currentRotation[57];
pinky_s_l = currentRotation[58];
index_f_l = currentRotation[59];
middle_f_l = currentRotation[60];
ring_f_l = currentRotation[61];
pinky_f_l = currentRotation[62];
index1_f_l = currentRotation[63];
middle1_f_l = currentRotation[64];
ring1_f_l = currentRotation[65];
pinky1_f_l = currentRotation[66];
thumb_f_l = currentRotation[67];
thumb__s_l = currentRotation[68];
thumb1_f_l = currentRotation[69];
thumb_s_l = currentRotation[70];
thumb2_f_l = currentRotation[71];
shoulder_f_r = currentRotation[72];
shoulder_s_r = currentRotation[73];
shoulder_r_r = currentRotation[74];
upperarm_f_r = currentRotation[75];
upperarm_s_r = currentRotation[76];
forarm_f_r = currentRotation[77];
forarm_s_r = currentRotation[78];
forarm_r_r = currentRotation[79];
hand_f_r = currentRotation[80];
hand_s_r = currentRotation[81];
hand_r_r = currentRotation[82];
palm_r = currentRotation[83];
index_s_r = currentRotation[84];
middle_s_r = currentRotation[85];
ring_s_r = currentRotation[86];
pinky_s_r = currentRotation[87];
index_f_r = currentRotation[88];
middle_f_r = currentRotation[89];
ring_f_r = currentRotation[90];
pinky_f_r = currentRotation[91];
index1_f_r = currentRotation[92];
middle1_f_r = currentRotation[93];
ring1_f_r = currentRotation[94];
pinky1_f_r = currentRotation[95];
thumb_f_r = currentRotation[96];
thumb__s_r = currentRotation[97];
thumb1_f_r = currentRotation[98];
thumb_s_r = currentRotation[99];
thumb2_f_r = currentRotation[100];
}