Project Download 12/07/2014: Download
(There are no binaries in this download. Only source. Double-click the ‘UPROJECT’ file to compile.)
Forward: Let me start off by saying, this is probably the most bass ackwards way of approaching this. I am sure that the code can be improved, however, I ran into around half a dozen people asking how to do this with no answers. I had to ask many indirect questions to get to this (rather simple) solution. I will improve this code as I work on a little spike project for you all, a local multiplayer platform game.
Definition: Hollow Bottom Platform - A platform that can be jumped at from any angle, and will not generate a solid collision unless the player is above it. Different from a solid platform, which will generate collision at any angle.
Problem: This is a solution for a multiplayer platform game like SSB. You can not just switch the collision on and off with the platform using triggers, as this would affect every player. You must use collision channels on the character itself.
Example: In this example, I use 3 collision channels.
WorldDynamic - Is used this for the platforms. The blueprints are set to block all, and World Dynamic. There is an exclude list to make sure you are not accidentally including the player or other dynamic objects. Make sure to add the tag ‘platform’ to platforms.
WorldStatic - Is all impassible objects, things like the walls and bottom platform in this example. All World Static actors will be blocked from all sides. Make sure to set any ground objects with a tag called ‘ground’.
Pawn - We want the players to still be able to run past each-other, so this is always overlap.
I’ve included the project as well.
- For platforms/ground objects, tick all collisions to ‘block’. A ‘block’ only happens when both the character and the object are set to block. We are abusing this by turning on and off the ‘block’ of the character component.
- Sprites will need to be added as the root object to a blueprint, otherwise collision channels will not work properly.
- This will work with as many players as you would like.
- This is a spike project of our main project. I will release updates on it as I go. We will be most likely using 4.5.1 as we develop, as that is the version we have locked into.
- I swiped the Trace() function from the Wiki: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums
- Also, a big thanks to BaderThanBad, who helped quite a bit with this question.
- Hollow Bottom Platforms are set to World Dynamic, and have a tag of ‘platform’.
- Full Solid Platforms are set to World Static, and have a tag of ‘ground’.
- Full Solids are set to World Static, and have no tag.
There is some code commented out here and there. Just ignore that. This will be an evolving project that I update here and there.
Hollow Bottom Platforms
Jump Through Platforms