Slopes with ceilings errors
by Thomas Pereira · in Torque X Platformer Kit · 06/25/2007 (10:12 pm) · 5 replies
I'll try to describe this as specifically as possible followed with a little text picture. When you create a platform with an angle - say 45 degrees - and make another platform that is just a solid box at the top of the slope with a corner of the box sticking out of the slope and a crack below, you will be allowed to move right through the crack which is far to small for the collision polygon to get through. Occasionally, you will fall right through the ground. Heres a text picture to help illustrate:
What I'm trying to show is the character collision polygon is too small to fit in the crack at that peak between the ceiling and ground, yet you can edge through it or fall through it.
CEILING
____________________________________________________________________
____
/\ <- | |
/ \ |____| CHARACTER, MOVING LEFT
/ \
GROUND / \
/ \
/ \What I'm trying to show is the character collision polygon is too small to fit in the crack at that peak between the ceiling and ground, yet you can edge through it or fall through it.
About the author
#2
That being said, I thought it was an unknown error - if it can be fixed, it would be appreciated, otherwise I will add it to my list of needed modifications and do it myself.
06/26/2007 (12:18 pm)
Well, I do sort of the need capability but I suppose I COULD work around it with level design. The main reason I need it to be flexible is the player will be controlling characters with different collision polygons...like say, a mouse that can get in small holes, or a human character that can 't. See what I mean? That being said, I thought it was an unknown error - if it can be fixed, it would be appreciated, otherwise I will add it to my list of needed modifications and do it myself.
#3
I'm looking at it right now, and it seems like I actually did put in a special check for cases like this. If you take a look at the following section starting at line 1159 you'll see what I'm talking about:
On second thought, is it possible that the ceiling in your case doesn't have a platform component? That would definitely explain why _moveSpeed isn't getting reset (allowing the player to keep walking).
ActorComponent.cs (line 1088)
As you can see, if the ceiling isn't a platform, the actor will not resolve against it. If the ceiling is then resolving against the actor it could most definitely push the actor down through the floor.
Let me know if this isn't the case and I'll dig a little deeper.
06/26/2007 (12:41 pm)
It can definitely be changed to work that way. What you'd want to do is take a look at the ResolveActorCollision method in ActorComponent.cs.I'm looking at it right now, and it seems like I actually did put in a special check for cases like this. If you take a look at the following section starting at line 1159 you'll see what I'm talking about:
if (_onGround && !groundSurface)
{
// don't let the clamp push us off the ground or into the ground!
// accomplish this by clamping the collision normal against the ground normal
float groundDot = Vector2.Dot(info.Normal, _groundSurfaceNormal);
// remove any portion of the ground surface normal from the collision normal
info.Normal -= groundDot * _groundSurfaceNormal;
// cancel move speed (this isn't a ground surface that we hit)
_moveSpeed.X = 0;
}On second thought, is it possible that the ceiling in your case doesn't have a platform component? That would definitely explain why _moveSpeed isn't getting reset (allowing the player to keep walking).
ActorComponent.cs (line 1088)
public virtual void OnCollision(...)
{
// call our custom collision resolve
// (this is almost exactly the same as clamp, but takes *both* objects' velocity into account)
if (theirObject.TestObjectType(PlatformerData.PlatformObjectType))
resolve = ResolveActorCollision;
else
resolve = null;
-...-
}As you can see, if the ceiling isn't a platform, the actor will not resolve against it. If the ceiling is then resolving against the actor it could most definitely push the actor down through the floor.
Let me know if this isn't the case and I'll dig a little deeper.
#4
I really don't know I perceived this right or not but what I have understood is that you do not want the player to slip through the crack between the slope top and ceiling above while a smaller player should.
I tried this with the ninja one and this is the remedy I came out with (again without scripting).
No idea this will work with you or not ( as you not using cast collision) but my guess is you have already sorted this out.
I used an invisible data object in between the slope(with custom polygon points.) and there is no way the character will go through, but the points of the object can be made at such a height that a smaller character can easily go through without colliding with the invisible points and if you have many such cracks, then just copy paste the invisible object.
Does this idea helps ?
I wish I could do everything without scripting, but that is not possible lols ;)

BTW- My ninja has very small custom polygon and not square one thats why I used invisible object a bit lower.
06/28/2007 (3:31 am)
Ok ThomasI really don't know I perceived this right or not but what I have understood is that you do not want the player to slip through the crack between the slope top and ceiling above while a smaller player should.
I tried this with the ninja one and this is the remedy I came out with (again without scripting).
No idea this will work with you or not ( as you not using cast collision) but my guess is you have already sorted this out.
I used an invisible data object in between the slope(with custom polygon points.) and there is no way the character will go through, but the points of the object can be made at such a height that a smaller character can easily go through without colliding with the invisible points and if you have many such cracks, then just copy paste the invisible object.
Does this idea helps ?
I wish I could do everything without scripting, but that is not possible lols ;)

BTW- My ninja has very small custom polygon and not square one thats why I used invisible object a bit lower.
#5
Both the ceiling and the ground have the platform component applied. After some more tweaking, I've managed to make the play jitter oddly. It is most prominent when going left, but also exists when going right. I would find it very hard to believe if this bug is because of improper scene setup.
06/28/2007 (5:40 pm)
Thomas:Both the ceiling and the ground have the platform component applied. After some more tweaking, I've managed to make the play jitter oddly. It is most prominent when going left, but also exists when going right. I would find it very hard to believe if this bug is because of improper scene setup.
Torque Owner Thomas Buscaglia
EDIT: If this sort of functionality is neccesary for your game or the collision box solution is insufficient let me know.