Unreal.js
Unreal.js copied to clipboard
How to subscribe for events?
I want to run some code when player controller collides trigger. I used to check GetOverlappingActors in loop but nothing returns. Possible solution is to use OnActorBeginOverlap, but how to use events un Unreal.js ?
In Javascript, register the callback function in the OnActorBeginOverlap delegate.
In Javascript, register the callback function in the OnActorBeginOverlap delegate.
can you provide simple example, please?
var color_material = Material.Load('/Game/Color.Color')
var actor = new StaticMeshActor(GWorld)
var material = KismetMaterialLibrary.CreateDynamicMaterialInstance(GWorld, color_material)
var smc = actor.StaticMeshComponent
smc.SetMobile()
smc.SetStaticMesh(mesh)
smc.SetMaterial(0, material)
actor.OnActorBeginOverlap.Add((overlaped, other) => {console.log(other});
https://github.com/ncsoft/Unreal.js/wiki/Delegates