# making a device disapear as soon as it collides with a player

**URL:** <https://forums.unrealengine.com/t/making-a-device-disapear-as-soon-as-it-collides-with-a-player/1673118>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [February 7, 2024, 9:50pm UTC](https://forums.unrealengine.com/t/making-a-device-disapear-as-soon-as-it-collides-with-a-player/1673118 "2024-02-07T21:50:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnelKurzester71](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AnelKurzester71](https://forums.unrealengine.com/u/AnelKurzester71)\
**Post date:** [February 7, 2024, 9:50pm UTC](https://forums.unrealengine.com/t/making-a-device-disapear-as-soon-as-it-collides-with-a-player/1673118/1 "2024-02-07T21:50:23Z")

</div>

i want to make a trigger device disapear as soon as it collides with a player. i thought of implementing the disapearing by just teleporting the trigger away for example multiplying the vectors with a constant.

(pseudo)verse code:  
trigger.TriggeredEvent.Subscribe(OnTriggered)

OnTriggered(trigger)… void=  
if(trigger.TeleportTo[position\*1000.0,rotation])

the problem is it gives me a error with something about suspends. anyone have coding suggestions/implementations

---

<div class="post-metadata">

**Author:** ![BdawgsLit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BdawgsLit](https://forums.unrealengine.com/u/BdawgsLit)\
**Post date:** [February 7, 2024, 10:55pm UTC](https://forums.unrealengine.com/t/making-a-device-disapear-as-soon-as-it-collides-with-a-player/1673118/2 "2024-02-07T22:55:28Z")

</div>

is that your full code?? your missing a lot of the bulk

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

GameManager_Disapearing := class(creative_device):
#change to whatever device you want to disappear
   @editable
   whatverdeviceyouwanttohide: device_device = device_device{}

   HideTrigger:trigger_device = trigger_device{}

    OnBegin<override>()<suspends>:void=
         HideTrigger.TriggeredEvent.Subscribe(HideDevice)

    HideDevice():void=
        spawn:
            HideOnTrigger() #we need to spawn <suspends> functions

    HideOnTrigger()<suspends>:void=
    whatverdeviceyouwanttohide.Hide<public>():void = external {}
    Sleep(4.0)
    whatverdeviceyouwanttohide.Show<public>():void = external {}

```

this wont work but definitely gets you a whole lot closer then whatever AI gave you in that last string. this essentially is just a make device disappear button, as its not set up to make whatever you touch disappear, but whenever that bound trigger gets triggered it would make the disappear. Im sure the logic for sending signals on player collosion is there I just dont know it - if you get stuck you can always set the device to have no colloision and put a volume in it that sends a signal to your game manager that then in turn either disables or make it go somewhere You also cant hide devices using Hide():void = external {} so setting it to teleport might be the move however I found it quite difficult to move things with verse so good luck

---

<div class="post-metadata">

**Author:** ![AnelKurzester71](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AnelKurzester71](https://forums.unrealengine.com/u/AnelKurzester71)\
**Post date:** [February 8, 2024, 3:31pm UTC](https://forums.unrealengine.com/t/making-a-device-disapear-as-soon-as-it-collides-with-a-player/1673118/3 "2024-02-08T15:31:21Z")

</div>

my code:

using { /Fortnite.com/Devices }  
using { /Verse.org/Simulation }  
using { /UnrealEngine.com/Temporary/Diagnostics }  
using { /UnrealEngine.com/Temporary/SpatialMath}

# See [Create Your Own Device Using Verse in Unreal Editor for Fortnite | Fortnite Documentation | Epic Developer Community](https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse) for how to create a verse device.

# A Verse-authored creative device that can be placed in a level

trigger\_logic\_device := class(creative\_device):  
@editable  
var device : trigger\_device = trigger\_device{}

# on collision detection: Position ändern

# nach 10 sekunden neue Position

```
OnBegin<override>()<suspends>:void=
    device.TriggeredEvent.Subscribe(OnTriggered)
    RotateDevice(device)

OnTriggered(Devices : trigger_device)<suspends> :void=
    Despawn(Devices)

RotateDevice(Devices : trigger_device)<suspends> : void=
    Transform := Devices.GetTransform()
    Position := Transform.Translation
    Rotation := Transform.Rotation
    NewRotation := Rotation.ApplyYaw(180.0)
    MoveResult := Devices.MoveTo(Position, NewRotation, 2.0)
    if(MoveResult = move_to_result.DestinationReached):
        RotateDevice(Devices)

Despawn(Devices : trigger_device)<suspends> :void=
    Transform := device.GetTransform()
    Position := Transform.Translation
    NewPosition := vector3{X := 3000.5, Y := 7000.5, Z := 0.0}
    FinalLocation := vector3{X := Position.X, Y := Position.Y, Z := 0.0}
    Rotation := Transform.Rotation
    Sleep(10.0)
    if(device.TeleportTo[NewPosition,Rotation]){}
    
    if(device.TeleportTo[Position,Rotation]){}

```

error message:  
for line “device.TriggeredEvent.Subscribe(OnTriggered)” the “OnTriggered” is marked with the message:  
“This function parameter expects a value of type ?agent-\>void, but this argument is an incompatible value of type type{\_(:trigger\_device):void}.(3509)” do you know how to fix it?  
what i thought of in this code is if the trigger is triggered (so it basically collided with a player) then i want it to teleport to somewhere it cant be seen and after 10 seconds it teleports back to its original position
