Game Development Community

PickArea problems

by Alpha-Kand · in Torque 2D Beginner · 03/21/2013 (9:21 am) · 2 replies

Howdy,

So I am trying to remake my platformer engine I made in the old torque and it is going SO MUCH smoother than before in this new engine. Right now I'm working out some kinks in the slopes and crouching/sliding.
I have it set up where if you press the crouch key your character crouches and when you release the key it needs to check if it can get up. That works fine with low walls but it has an issue on slopes.

I have a slope object with is just a big triangle. I am using the pickArea function to check above the character when it crouches.
When the pickArea function is set to check for Size AND the character is crouching AND the crouch key is released AND the character is on the slope the character doesn't get up, I figure it is colliding with the meta-rectangle the slope sprite makes because of it's size and that every sprite is technically a rectangle.
So I changed the pickArea function to check for Collision and it STILL doesn't get up. It only gets up if the character's top most edge is above the highest part of the triangle or totally to the left or right of the triangle. That behavior mimics the Size checking mode.

I looked into the source code and all that WorldQuery is confusing for someone new to it.

I double checked the parameters I pass to pickArea and those are NOT the problem.
Anybody have any ideas?


BTW, what does the "any" mode mean? For my setup it acts the same as Collision and Size.

EDIT: I found out what the Any mode is. It is a combination of Collision and Size.

About the author

I have always loved video games and computer games so decided to try making my own. Spent a little more than a year on a program simply named Game Maker which really got me interested. Finally decided to get "professional" by getting Torque 2D.


#1
03/22/2013 (3:41 am)
The pick mode "area" picks the AABB region of the object. The pick mode "collision" picks collision shapes intersecting the pick region. The pick mode "all" does both because it's possible to have collision shapes outside the AABB region as the AABB region is only defined by the "size" which (typically) relates to rendering.

To be clear, the pick is against the AABB and NOT the OOBB so if you've got an angled object then the AABB will typically be larger than the object.

No ideas really on what's going wrong in your set-up. Maybe you should try a ray-cast instead using "pickRay()" although in the end, as long as the area you're picking is correct it'll return objects in that area so I have no idea how that reacts to your logic.

I wanted to change the picking to provide more explicit control allow for the following modes:
    Collision - pick collision shapes
  • AABB - pick AABB
  • OOBB - Pick OOBB (typically the region being rendered)

... just so many other things took my time however.
#2
03/22/2013 (5:31 pm)
Ugh, I guess I wasn't very clear was I?

What I meant to say was that the pickRect picks the slope object REGARDLESS of it colliding with the collision shape.

The character is sitting on a triangle and is checking above it for a collision and it returns that it is touching the triangle it is sitting on, which is impossible, but it IS touching it's render rectangle. When the pickRect is NOT touching the render rect it reports as no more collision.

I can't remember what OOBB exactly stands for but I will take a guess as Object Overlapping Bounding Box?