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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Simple Collision Question

A C++ or Blueprint solution are both acceptable, as I can translate the blueprint into C++.

This should be a fairly straight forward question. We have a platform, it generates an overlap event. We have the base test character from the base test Paper2D example. I setup a few variables with a custom place_meeting. When free = 0, that means that just under the player, it has found a platform.

How can I stop the player falling. I do not want to use trigger volumes, or make the character or platform change overlap types. This is for a local multiplayer (4 controllers 1 screen - no networking or online) game where up to 4 players will be playing at once. I need a way to stop the character falling, without effecting the environment or the other players.

For example, if I set the player to 'block all' then they could not run past another player. I can not change the overlap types of the player, or the platform. They both must remain 'Overlap All'.

 void ATestPlatCharacter::Tick(float DeltaSeconds){
     FVector coords = GetActorLocation();
     x = coords.X;
     z = coords.Z;
     depth = coords.Y;
     if (place_meeting<APlatformParent>(x,z - 1)) {
         free = 0;
     else {
         free = 1;
     if (free == 0) {
         //Stop the player falling. Should still be able to move and such. Is standing on a platform.
     else {
         //Player is not on a platform. Should be falling or whatever else.
Product Version: Not Selected
more ▼

asked Dec 06 '14 at 03:10 PM in C++ Programming

avatar image

The Britain
73 19 14 18

avatar image BaderThanBad Dec 07 '14 at 02:44 PM

With some tweeking I think you should be able to use custom collision presets that will do what you want. You can also do traces to figure out if something is under you.

avatar image The Britain Dec 07 '14 at 03:30 PM

There are two types of platforms.

Block All - Which block from all directions constantly. With this one, I am just setting it to dynamically block all, and using a short bottom ray trace to see if the character is standing on it.

Hollow Bottom - This is a bit more tricky, as the player needs the ability to move through the platform and land on top. I can't change the overlap state of the actor or the platform, as this is a 4 player fighting game, where multiple people will be on the screen at the same time. So trigger volumes are out as well. This, along with the player character component, must remain 'overlap all'.

avatar image BaderThanBad Dec 07 '14 at 04:22 PM

Aha that is indeed trickier. I do however believe that a solution with changing the overlap state of actors is possible. As you said, changing the states of the platforms won't work, but I think that changing the overlap state of the player so that when he is jumping upwards he can go through those hollow bottom platforms and if he is falling downwards and the platform is beneath him he goes back to his normal state.

avatar image The Britain Dec 07 '14 at 04:28 PM

Then we would have a player that is switching in and out of collision with other players mid combat.

avatar image BaderThanBad Dec 07 '14 at 04:32 PM

change the state to ignore the platforms only. The collision system is very flexible and you can change each channel behavior separately.

avatar image The Britain Dec 07 '14 at 04:41 PM

I did not know you could do that per character. Are there any tutorials on collision channels? Blueprint is fine, as I can convert it over to C++.

avatar image BaderThanBad Dec 07 '14 at 04:45 PM

link text Try reading through that. It is a pretty self explanatory concept so I am sure you'll get what you need working after tweaking and such.

avatar image The Britain Dec 07 '14 at 05:00 PM

So basically, what I am seeing here, is I want to set up my platforms as World Statics with block all excepts pawns. In this way, my pawn will fall through the platform. Then on the pawn itself, switch on and off block world statics?

avatar image The Britain Dec 07 '14 at 05:07 PM

So I tried setting my platforms as world static, and then setting the collision type for pawn to overlap. The character falls through, I then set the collision response type on the character for world static to block:

 CapsuleComponent->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Block);

The character is still falling through the platform, albeit, I think we are getting closer.

Edit: I must be tired. Both must be block, so by using the line above and this, I can turn off and on collision. Now when I get that Raycast figured out, I will have this working. I will put up a tutorial when this is done and give you credit.

 CapsuleComponent->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Answer here: https://forums.unrealengine.com/showthread.php?53767-Hollow-Bottom-Platforms&p=189343

Thanks to BadderThanBad for pointing me in the right direction.

more ▼

answered Dec 08 '14 at 04:03 AM

avatar image

The Britain
73 19 14 18

(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