x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Moving platform that "stops" when it hit something

Hi all,

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?

Product Version: Not Selected
Tags:
more ▼

asked Jan 10 '15 at 07:28 PM in Blueprint Scripting

avatar image

ShrewGlue
444 99 84 108

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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):

alt text

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.

more ▼

answered Jan 14 '15 at 10:32 PM

avatar image

Kevin0814
31 4 5 6

avatar image ShrewGlue Jan 15 '15 at 01:04 AM

Alright! And then if the hit direction is in the actor's general "head" area I'll reverse it. How do I set it so that if the hit area is in the actor's general head area (a capsule) then it tells it to reverse?

avatar image Kevin0814 Jan 19 '15 at 08:19 PM

So, to make it so that when the hit direction is the actor's general "head" area, you could edit the static mesh so that it has a collision box covering it and above it (at the player's approximate height level) like so: alt text

Now you can make it so that if the platform is moving and it encounters a collision, the matinee will reverse. Make sure that in the static mesh's collision options in the side panel in the level editor are set to "block all dynamic". Now, I'm pretty sure this will make it so that the box collision above the platform will prevent the character from going through it, so you may want to put it above the main character's head.

*Note: There's an option under "collision" that lets you set it so that the collision detects everything except characters and pawns, which would be a better option, but I think that the player would fall through the floor if that option is used. I'm not quite sure, though, (matinee and collisions are not me forte) so try playing around with it.

[1]: /storage/temp/27220-box+trigger+static+mesh.png

avatar image ShrewGlue Jan 20 '15 at 01:25 AM

Thank you! This is exactly what i need. last thing is that the platform wont always be moving up and down; I'll be using the same Blueprint for the platform going left to right. So depending on if the platform is going vertically or horizontally, the distance between the collision box and the platform will need to be either the characters capsule height or the capsule diameter. How do i set this up?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi ShrewGlue,

I would like some help on how to create moving platform, than goes up 100 units.

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.

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.

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. "

Ideally, it would also ignore the character if this is possible.

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

more ▼

answered Jan 12 '15 at 10:46 AM

avatar image

MefazM
66 5 3 10

avatar image ShrewGlue Jan 14 '15 at 10:10 PM

Thanks for the help! I have two questions 1) I'm stuck in an infinite loop here: alt text

2) Also how would (I'm now assuming the player can start the platform) I make the platform stop when a player on the platform collides with something overhead. Here is a picture alt text

In this case if the player and platform are both going upwards, and the player collides with something overhead. The platform will return to it's original poisiton

collision.png (8.6 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question