This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPROPERTY(EditAnywhere, Category=Pawn) | |
float speed; | |
UFUNCTION(BlueprintCallable, Category=Attachment) | |
void do() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
a shader executes per pixel | |
so every thing you see here is he function for every pixel | |
raymarching is in principe a function that finds the closest point to any surface in the world | |
then we move our point by that distance and use the same function, | |
the function will probably be closer to an object in the world every time | |
and after about 40 to 200 iterations you'll either have found an object or | |
missed them all into infinity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
IMPORTANT! | |
In order to be able to use this functions, in the file "YourProject.h" change this: | |
#include "EngineMinimal.h" | |
For this: | |
#include "Engine.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ChangeMaterial(UMaterial *material) | |
{ | |
TArray<UStaticMeshComponent*> meshes; | |
GetComponents<UStaticMeshComponent>(meshes); //Get all the mesh components | |
for (UStaticMeshComponent *mesh : meshes) | |
mesh->SetMaterial(0, material); //For each mesh component, set the material (the 0 is the element index of the material) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UFUNCTION: https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Functions/index.html | |
RAY TRACING: https://wiki.unrealengine.com/Trace_Functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The key to this is to make a normal UMG, but use the Blueprint function SetAnchors, where Minimum and Maximum inputs to this function go from 0.0 -> 1.0 (normalized screen size). | |
For example, if I want to put an UMG which only occupies the right bottom corner of the screen, I would use: | |
SetAnchors, where Minimum = (0.5, 0.5) and Maximum = (1.0, 1.0) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Ok, so you want to change your Object Type (or collision channel) to a custom channel in runtime. | |
But there's a problem, it seems UE4 doesn't support this yet, but there's a workaround hehe :) | |
For example, imagine you create the ObjectType Building. | |
Now, imagine you want to change the ObjectType of all the StaticMeshComponents of the object OBJECT (from WorldStatic to Building, for example). | |
You can try something like this: | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "DrawDebugHelpers.h" | |
DrawDebugLine(GetWorld(), traceStart, traceEnd, FColor::Green, true, 1.0f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APlayerCameraManager *camManager = GetWorld()->GetFirstPlayerController()->PlayerCameraManager; | |
FVector camLocation = camManager->GetCameraLocation(); | |
FVector camForward = camManager->GetCameraRotation().Vector(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For Components ================================= | |
UFUNCTION() | |
void OnBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult); | |
UFUNCTION() | |
void OnEndOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex); | |
// Register events in BeginPlay | |
OnComponentBeginOverlap.AddDynamic(this, &MyClass::OnBeginOverlap); //Register the BeginOverlap event | |
OnComponentEndOverlap.AddDynamic(this, &MyClass::OnEndOverlap); //Register the EndOverlap event | |
// ================================================= |