Hello, ive been shooting in the dark for some time now how to pull this off.
As in the old Sidescrollers where you could walk up stairs by pressing “Up” while in a area close to the stairs, if you just walked by the stairs was just a part of the background.
This is one of my tries, the “Trigger animation” is just somthing i use to debug to see if it “works” so far.
A) your cast to button will fail everytime because its casting no object into it. The code would look like this for your character cast and your button cast respectively in pseudo-code
Your animation will play but remember its just an animation your not actually moving the character at the end of it unless you have a weird animation, which you could do, an animation that ends at the top of the stairs then you want
OnBeginOverlap(box) → OtherActor == SideScrollerCharacter reference variable (do the cast in BeginPlay so it doesnt have to cast over and over) into a branch → True: PlayAnimation(UpStairs) → set bCharacterWentUpStairs to true → Delay(5s) → set bCharacterWentUpStairs to false (safety measure incase it bugs out)
OnEndOverlap(box) → SetWorldLocation(SideScrollerCharacter) to GetWorldTransform of GetNearestActorOfClass(stairs) this verifiys they will be placed at the top of the stairs, make sure your stairs actor has its pivot at the very top, and you may need to add some vector +z ontop of that or get upvector * float(50) something similar. Then set bCharacterWentUpStairs = false
First that that comesoutta my brain, your setup above isnt going to just move the character up “stairs” which you never stated, stairs are a mesh I assume, thats where the pivot being at the top of the mesh (or higher) becomes important for the above implementation.
Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.