-
Notifications
You must be signed in to change notification settings - Fork 351
Mouse over to move a box
Nako Sung edited this page Nov 27, 2015
·
2 revisions
let asset = StaticMesh.Load('/Game/Geometry/Meshes/1M_Cube.1M_Cube')
class MyBox extends StaticMeshActor {
ctor() {
this.StaticMeshComponent.SetStaticMesh(asset)
this.StaticMeshComponent.SetMobility('Movable')
}
ReceiveActorBeginCursorOver() {
super.ReceiveActorBeginCursorOver() // not necessary
let pos = this.GetActorLocation()
pos.Z += 10
this.SetActorLocation(pos)
}
}
function test() {
let MyBox_C = require('uclass')()(global,MyBox)
let box = new MyBox_C(GWorld)
let PC = GWorld.GetAllActorsOfClass(PlayerController).OutActors[0]
PC.bEnableMouseOverEvents = true
PC.bShowMouseCursor = true
return function () {
box.DestroyActor()
}
}