Skip to content

Instantly share code, notes, and snippets.

View sephirot47's full-sized avatar

Victor Anton Dominguez sephirot47

View GitHub Profile
@sephirot47
sephirot47 / UE4 Little UMG or Set UMG size or Set UMG Position .cpp
Last active January 28, 2021 09:01
UE4 Little UMG or Set UMG size or Set UMG Position
/*
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)
*/
@sephirot47
sephirot47 / UE4 Interesting documentation links
Last active August 29, 2015 14:24
UE4 Interesting documentation links
@sephirot47
sephirot47 / UE4 Set-Change Material .cpp
Last active January 28, 2021 09:01
UE4 Set-Change Material
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)
}
@sephirot47
sephirot47 / gist:8e475b090d4314b6a628
Created June 30, 2015 14:32
UE4 Get Viewport / Screen Size and Center
/*
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"
@sephirot47
sephirot47 / GLSL Raymarch ShaderToy tutorial and example code
Created June 29, 2015 12:28
GLSL Raymarch ShaderToy tutorial and example code
/*
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
@sephirot47
sephirot47 / UE4 UPROPERTY UFUNCTION
Created June 28, 2015 20:52
UE4 UPROPERTY UFUNCTION
UPROPERTY(EditAnywhere, Category=Pawn)
float speed;
UFUNCTION(BlueprintCallable, Category=Attachment)
void do() { }
@sephirot47
sephirot47 / UE4 Bind Action
Last active August 29, 2015 14:23
UE4 Bind Action
character->InputComponent->BindAction("Jump", IE_Pressed, this, &AMyCharacter::HandleJump);
character->InputComponent->BindAction("Jump", IE_Released, this, &AMyCharacter::HandleJump);
@sephirot47
sephirot47 / UE4 World to screen point
Created June 18, 2015 15:32
UE4 World to screen point
//From the actor's viewport (camera)
FVector2D result;
UGameplayStatics::GetPlayerController(actor, 0)->ProjectWorldLocationToScreen(pointInWorld, result);
//result now has the screen point(x,y)
@sephirot47
sephirot47 / UE4 Get Player Controller of an Actor
Created June 18, 2015 15:31
UE4 Get Player Controller of an Actor
UGameplayStatics::GetPlayerController(actor, 0)
@sephirot47
sephirot47 / UE4 Load Texture
Created June 17, 2015 20:54
UE4 Load Texture
//En el constructor (no el BeginPlay)
UTexture2D *texture;
static ConstructorHelpers::FObjectFinder<UTexture2D> Texture(TEXT("/Game/StarterContent/Textures/T_Spark_Core.T_Spark_Core"));
texture = Texture.Object;