You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
732 B
40 lines
732 B
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "Robot.h"
|
|
|
|
ARobot::ARobot(){
|
|
PrimaryActorTick.bCanEverTick = true;
|
|
}
|
|
|
|
void ARobot::BeginPlay(){
|
|
Super::BeginPlay();
|
|
|
|
GetComponents<ULink>(Parts);
|
|
for (auto* Link : Parts) Link->Setup();
|
|
}
|
|
|
|
void ARobot::Tick(const float DeltaTime){
|
|
Super::Tick(DeltaTime);
|
|
|
|
constexpr int SubSteps = 10;
|
|
const double h = DeltaTime / SubSteps;
|
|
for (int i = 0; i < SubSteps; i++){
|
|
for (auto* Link : Parts) Link->Update(h);
|
|
SolvePositions();
|
|
for (auto* Link : Parts) Link->Integrate(h);
|
|
SolveVelocities();
|
|
}
|
|
|
|
for (auto* Link : Parts) Link->UpdateVisualTransform();
|
|
}
|
|
|
|
void ARobot::SolvePositions(){
|
|
|
|
|
|
|
|
}
|
|
|
|
void ARobot::SolveVelocities(){
|
|
|
|
}
|
|
|