Moving platform that "stops" when it hit something
I would like some help on how to create moving platform, than goes up 100 units.
However, if it would "hit" something it would stop, and then return back to it's original position.
so if it was extend 49 units and hit something on the 50th unit. It would go back 50 units.
Ideally, it would also ignore the character if this is possible.
How would I make this?
asked Jan 10 '15 at 07:28 PM in Blueprint Scripting
Another way you could do it would be with a matinee, like they do in this tutorial: [https://www.youtube.com/watch?v=-qVgDUV0qpw] except only animate it one way (either going up or going down; doing both is unnecessary).
Make it so that when the platform is stepped on initially, it plays the matinee and activates a boolean that says that the platform is moving. Put a delay that lasts for the duration of the animation that turns the boolean off after it finishes. Then have it so that if the boolean is true, and the platform hits something, it activates the node "Change Play Direction." This will stop the currently playing animation and make it turn around until it reaches its original position or hits another object.
Additionally, if your platform reaches the end without anything, you can use the "Reverse" node to play the animation to play it from the end back to the beginning.
It's a lot less work in the blueprints. If you do it right, it'll look something like this (but with your reverse play direction boolean in place):
To answer your second question (how would you do it if the player collides), you could use the OnActorHit command for the player's character and have an event that changes the matinee play direction if the boolean is on.
answered Jan 14 '15 at 10:32 PM
Here you already known that you need a function in your "Platform_BP". Will call it "Move" There is simple calculations. You should get Actor Transform and adding +100 units in directions what you like, if you wish you can add to calculations "Lerp" or "Ease" to make smooth interpolation.
To do this part i'll recommend you to add Box Shape Component to your BP and then use it as Overlap Box. Generated Overlap Event will return to you Actors that Overlapping that box right now. "
Here you may set "Ignore Only Pawn" Collision Preset on your Box Shape Component in your "Platform_BP". It will ignore player pawn and will not generated any events in this case.
Well, if i misunderstood you somewhere let me know, or you will have additional questions, let me know here
Best wishes, MefazM
answered Jan 12 '15 at 10:46 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here