My question is how to move a glass door move side to side by standing on a trigger. I know that I need 2 prop mover and 2 trigger and 2 glass door I thinking when my player hit the trigger that opening the glass siding door. I go inside then it behind me it closed when my player standing it inside the shower open again leave it close again and repeat it self when stand the trigger again ? I Can’t figure out ?
This should work for you:
(be sure to untick register with structural grid
in the door prop’s details) Also, I used the teleport commands over the MoveTo commands, as I’ve seen a lot of posts about issues with the MoveTo command. (should be easy enough to swap over to MoveTo once those issues are resolved on Epic’s end)
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
# A Verse-authored creative device that controls a sliding door or gate prop based on players being in proximity (triggered by the otherwise inert capture zone)
automatic_sliding_door_device := class(creative_device):
@editable
DoorProp:creative_prop=creative_prop{}
@editable
DoorTriggerVolume:capture_area_device=capture_area_device{}
@editable
ReplicationSwitch:switch_device=switch_device{}
#Fortnite grid size is 512x512x384
#Set this value to negative to change the direction of opening
HorizontalGridSize:float=512.0
var ClosedTranslation:vector3=vector3{X:=0.0, Y:=0.0, Z:=0.0}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
#Bind First and Last Agent events to control the switch
DoorTriggerVolume.FirstAgentEntersEvent.Subscribe(OnAgentEntered)
DoorTriggerVolume.LastAgentExitsEvent.Subscribe(OnAgentExited)
#bind the switch state changes to control the door movement
#using this 2 step process should ensure that the door will open and close for all players. This might be completely redundant, I have no way of testing that at this time
ReplicationSwitch.TurnedOnEvent.Subscribe(OnDoorOpen)
ReplicationSwitch.TurnedOffEvent.Subscribe(OnDoorClose)
OnAgentEntered(Agent:agent):void=
#Print("Agent Entered")
ReplicationSwitch.TurnOn(Agent)
OnAgentExited(Agent:agent):void=
#Print("Agent Exited")
ReplicationSwitch.TurnOff(Agent)
OnDoorOpen(Agent:agent):void=
#Print("Door Opened Called")
if (ClosedTransform:=creative_object[DoorProp].GetTransform()):
#First we get and save the original location of the door
set ClosedTranslation = ClosedTransform.Translation
#Depending on the mesh, you might need to use the localForward() or the LocalRight(),
#DoorRightVector:vector3=ClosedTransform.Rotation.GetLocalRight()
DoorRightVector:vector3=ClosedTransform.Rotation.GetLocalForward()
#you can change the open direction via (DoorRightVector*HorizontalGridSize*-1.0) (or set the HorizontalGridSize to -512.0)
OpenedTranslation:vector3=(DoorRightVector*HorizontalGridSize)+ClosedTranslation
#This teleport command has to be wrapped inside of an if statement
if(DoorProp.TeleportTo[OpenedTranslation,ClosedTransform.Rotation]):
Print("Door has been Opened")
OnDoorClose(Agent:agent):void=
Print("Door Closed")
#get the transform so we can use the rotation
if (OpenedTransform:=creative_object[DoorProp].GetTransform()):
#teleport the door back into the closed position
if(DoorProp.TeleportTo[ClosedTranslation,OpenedTransform.Rotation]):
Print("Door has been Closed")
Is there a way to not do this in verse code I’m am noob I can’t learn it
I’m not familiar enough with the game-only creative mode to be able to definitively know if its possible to do this without verse. It might be possible, it might not. (from what I’ve seen, it probably isn’t possible without the use of some verse code, thankfully, I’ve already written the code you’ll need )
Thank you I appreciate that I give it a try
Thank you so much for the code, @wasti ! I’m bookmarking this to mess with it later. It’s too bad MoveTo has been giving people trouble because it would be nice to be able to specify the amount of time the move takes, to make it gradual. Instead of TeleportTo, which just instantly changes its position, right?
Also what makes you suspect the door movement might not replicate for all players? Is that something I should worry about whenever I use the transform commands?
Btw have you considered posting this to the Snippets library sometime? Seems like a useful script to archive.
Edit: I see you already posted it to the Snippets repository, awesome!
Also @MasterDylan20 thanks for asking the question. I think a lot of creators would be interested in it.
you are welcome but I Don’t want use verse it so confusing to me
yeah, once Epic resolves the issues with MoveTo I will try to remember to update the snippet.
I suspect the door movement might not be replicated because I’m not familiar with any of this verse or async stuff. I’m unable to public publish a mod for another couple weeks, so have no way to A/B test things like this (with more than one player in the session).
I had read in documentation somewhere that the switch device is able to share a common state between all players, via enabling persistence and one other checkbox/dropdown. So just went with that and it seemed to function as expected when I launched it.
As far as doing this without verse, I think it’d be contingent on the capabilities of prop_manipulator_device
or prop_mover_device
Ok Thank you
Hi dylan
i think:
- you set “for error” to “ping pong” moviment. Simple set to stop at the end of moviment.
- check configuration and be sure “do nothing” when moviment find AI or player or other prob. Maybe one again is set to stop and come back
M.
Ok Thank you
Hi @MasterDylan20 Moved this over to the correct category for you. Thanks for the post!
oh sorry my bad I’m new how do I change it?