en:toolworks:docs:apparatus:mechanical

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:toolworks:docs:apparatus:mechanical [2021/06/08 12:47] – created vladiusen:toolworks:docs:apparatus:mechanical [2021/06/18 22:23] (current) vladius
Line 7: Line 7:
 If you're going the C++ way, creating your Mechanicals goes like this. If you're going the C++ way, creating your Mechanicals goes like this.
  
-  - +  - Open the main UE File menu and choose the "New C++ Class..." option: {{ :en:toolworks:docs:apparatus:ue-file-create-cpp-class.png?nolink |}} 
 +  - In the opened window mark the "Show All Classes" checkbox: {{ :en:toolworks:docs:apparatus:ue-add-show-all-cpp-classes.png?nolink |}} 
 +  - Now you can select any of the base classes available including the Apparatus ones. Choose the Mechanical Actor as a base class: {{ :en:toolworks:docs:apparatus:ue-create-cpp-mechanical-actor.png?nolink |}} 
 +  - Click "Next" and you should see a name choosing dialog. Adjust the name of the class as needed and proceed by pressing the green "Create Class" button at the bottom: {{ :en:toolworks:docs:apparatus:ue-name-cpp-mechanical-actor.png?nolink&600 |}} 
 +  - The new class gets created as a combo of its header (.h) and a source file (.cpp). All in the Source (sub)folder of your project. You should now see them in the IDE of your choice:{{ :en:toolworks:docs:apparatus:vscode-new-mechanical-actor-class-sources.png?nolink |}} 
 +  - Note that you may have to recompile the project and/or restart the Editor after that. Don't be scared by some possible errors here, regenerate the IDE project, rebuild and start again.{{ :en:toolworks:docs:apparatus:vscode-generate-project-files.png?nolink |}} 
 +  - The corresponding file contents should be as: 
 +    * ''MyMechanicalActor.h'':<code cpp> 
 +// Fill out your copyright notice in the Description page of Project Settings. 
 + 
 +#pragma once 
 + 
 +#include "CoreMinimal.h" 
 +#include "MechanicalActor.h" 
 +#include "MyMechanicalActor.generated.h" 
 + 
 +/** 
 + *  
 + */ 
 +UCLASS() 
 +class MY_API AMyMechanicalActor : public AMechanicalActor 
 +
 + GENERATED_BODY() 
 +  
 +}; 
 +</code> 
 +    * ''MyMechanicalActor.cpp'':<code cpp> 
 +// Fill out your copyright notice in the Description page of Project Settings. 
 + 
 + 
 +#include "MyMechanicalActor.h" 
 +</code> 
 +  - Now you can override a single (or multiple) Tick method(s) as you usually would do in C++... 
 +    * ... in the header:<code cpp> 
 +void Tick(float DeltaTime) override; 
 +</code> 
 +    * ... and the source file:<code cpp> 
 +void AMyMechanicalActor::Tick(float DeltaTime) 
 +
 +    // Your mechanical code here... 
 +
 +</code> 
 +  - Proceed creating a [[en:toolworks:docs:apparatus:filter|Filter]] to [[en:toolworks:docs:apparatus:enchaining|enchain]] the Chunks/Belts in order to be [[en:toolworks:docs:apparatus:iterating|iterated]] upon.
  • en/toolworks/docs/apparatus/mechanical.1623145672.txt.gz
  • Last modified: 2021/06/08 12:47
  • by vladius