Platformer Wall-slide Mechanics Problem
by Alex Hodgkiss · in Torque Game Builder · 04/21/2009 (2:21 pm) · 4 replies
I'm setting up a platformer game (using the modified platformer tutorial as a base) in Megaman or Ninja style and I've managed to get basic movement, jumping, and dash working.
I'm trying to set up a mechanic for wall sliding (think MMX) so my player can slow fall on the side of a wall and have a short hop or projectile option, but I'm noticing that the current castCollision setup is having him "bounce" on and off the wall.
So if I'm running into the wall on the ground, the castCollision detects wall-ground-wall-ground-wall etc.
Same thing if i'm in the air: wall-nothing-wall-nothing-wall etc.
I'm afraid that it's going to jitter him on and off the wall improperly if I try to use Xnormal collisions as a base for wall sliding.
Is there anyway to circumvent or fix this?
I'm trying to set up a mechanic for wall sliding (think MMX) so my player can slow fall on the side of a wall and have a short hop or projectile option, but I'm noticing that the current castCollision setup is having him "bounce" on and off the wall.
So if I'm running into the wall on the ground, the castCollision detects wall-ground-wall-ground-wall etc.
Same thing if i'm in the air: wall-nothing-wall-nothing-wall etc.
I'm afraid that it's going to jitter him on and off the wall improperly if I try to use Xnormal collisions as a base for wall sliding.
Is there anyway to circumvent or fix this?
About the author
#2
- Cast Collision
- Found Wall
- Clear X-Axis movement
- Cast Collision
- No Wall
- Free to move, apply X-Axis movement
- Loop
Do you see what is happening there? When you hit the wall, it clears your x-axis speed. Then, when you come to cast collision in the future, you have no x-axis speed to trigger a collision with the wall so it will return false.
This is why you shouldn't use castCollision to create a platformer.
04/21/2009 (3:10 pm)
Alex, I suspect that what you are finding has nothing to do with TGB's collision "glitches" as Tyler suggested, but is more like something like this:- Cast Collision
- Found Wall
- Clear X-Axis movement
- Cast Collision
- No Wall
- Free to move, apply X-Axis movement
- Loop
Do you see what is happening there? When you hit the wall, it clears your x-axis speed. Then, when you come to cast collision in the future, you have no x-axis speed to trigger a collision with the wall so it will return false.
This is why you shouldn't use castCollision to create a platformer.
#3
04/21/2009 (4:31 pm)
Yeah I can see why it's doing it, I'm just not sure how to get around it. I've tried rewriting without using cast collision but I'm still somewhat of a novice. Can I properly detect movement and jumping without using castCollision? Perhaps just triggering onCollision? Any advice would be appreciated.
#4
I ended up using onCollision inside a behavior, to set up parameters to stop the object when it collides with a wall. It's useful because it works, and you can set up different parameters like the wall jump you mentioned. I'm not working on a platformer, but I'm sure it'd work for you.
Oh yeah, and like Tyler mentioned...the collision system is famous for being glitchy. There's talk of a newer edition coming out soon, but we'll have to wait and see what happens. Maybe it'll be released after GG has capitalized off of every console and mobile device for TGE/TGEA so TGB can get some love!
04/22/2009 (5:07 pm)
The collision for the project I'm working on has some screwed up thing, where objects with behaviors won't stop, when collided with objects using the built-in TGB collision system. They pass right through them. I ended up using onCollision inside a behavior, to set up parameters to stop the object when it collides with a wall. It's useful because it works, and you can set up different parameters like the wall jump you mentioned. I'm not working on a platformer, but I'm sure it'd work for you.
Oh yeah, and like Tyler mentioned...the collision system is famous for being glitchy. There's talk of a newer edition coming out soon, but we'll have to wait and see what happens. Maybe it'll be released after GG has capitalized off of every console and mobile device for TGE/TGEA so TGB can get some love!
Torque Owner Tyler Slabinski