Unreal.js icon indicating copy to clipboard operation
Unreal.js copied to clipboard

How to subscribe for events?

Open maxdeepfield opened this issue 6 years ago • 4 comments

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 ?

maxdeepfield avatar Aug 24 '18 20:08 maxdeepfield

In Javascript, register the callback function in the OnActorBeginOverlap delegate.

crocuis avatar Oct 02 '18 02:10 crocuis

In Javascript, register the callback function in the OnActorBeginOverlap delegate.

can you provide simple example, please?

maxdeepfield avatar Oct 04 '18 13:10 maxdeepfield

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});

crocuis avatar Oct 04 '18 14:10 crocuis

https://github.com/ncsoft/Unreal.js/wiki/Delegates

crocuis avatar Oct 04 '18 14:10 crocuis