One way collision (jump through & land on top)

Topics: User Forum
Nov 13, 2008 at 3:20 PM
Hi!

We are currently working on a side scroller (like many others as I found out by browsing through the forum ;) ) and are running into the following "problems":
  1. Isn't there a line collision which blocks one-way (which could be used for terrain or such)?
  2. How would one make a collision object which the player can jump through if standing under it, but gets blocked (read lands on it) if he falls down from over it? Is it the best practice to use the collision-notifier and check which direction the velocity of the player has (+y:dont block, -y:block)? The easiest way would be if there were these line collision objects(lets name em StaticWorldCollision or so) ;)
Or am I missing something here?
I would be grateful for any impulse how to tackle this!

Greetings,
Chris
Developer
Nov 13, 2008 at 4:38 PM
Farseer is limited to polygons only, for now. You can make concave polygons though. The method you described of checking the velocity is probably the best right now. Only problem with simply using velocity is if the player only jumps half way into the line they would get stuck. I hope this makes sense.

A better solution might be to set all obstacles as CollisionEnabled to false if they are above the players feet, then when the player jumps up they become true and provide collision again. This would require going through the list of obstacles every frame but that shouldn't take long. Only problem is if you need angled platforms. This would require some math but is certainly possible.

Another method would be to use the Separation Axis Therom (SAT) to find when the players Geom has passed above a plane (line segment) you define.
Nov 14, 2008 at 8:18 AM
Thanks for pointing that out.

I'm just curious: do you think static line collisions could be implemented easily? A colleague of mine mentioned that tunneling might be a big problem cause the line has no thickness.
And now after browsing through the manual, it lists tunneling under "Known issues", but also some workarounds like Swept collision detection (http://www.gamasutra.com/features/19991018/Gomez_1.htm).

Developer
Nov 15, 2008 at 1:35 AM
Well I will be working on getting SAT working for v2.1. I want to include some stuff to prevent all penetration, time-of-impact and swept narrow phase collisions.

Do you need angled platforms?

I may be able to help you come up with a solution, but my time is very limited right now so don't expect any records to be broken.
Nov 15, 2008 at 9:25 AM
That's great to hear!
Yes, angled plattforms are actually wanted (to not have to say required ;) ), and I guess our deadline for all the physics stuff is the end of the next semester, meaning around june/july 2009.
Our main problem currently is, that we're not yet very familiar with farseer, and need some time till we get into it.
But as soon as that is the case, and if you got nothing against it, I'll get back in touch with you so we can work something out and contribute it to farseer.
Developer
Nov 17, 2008 at 12:59 AM
Do you mind me asking what your major is and what your project is for?

I might be taking a term or 2 off school for some personal reasons and if I do I will have a lot more time to work on Farseer and my own game. Feel free to email me at mattbettcher@gmail.com with any thing you need or add. I always do what I can.
Nov 17, 2008 at 9:30 AM
Edited Nov 17, 2008 at 9:32 AM
I/We just started with our masters course in "Digital Media" with focus on computer games at the University of applied sciences in Hagenberg (Austria).
This is a project we did in our bachelors course: http://gamedev.fh-hagenberg.at/games/psi-paranormal-scene-investigation/ (Ogre for graphics and Newton for physics/collision)

Now we want to create a game for the XBox360 using XNA GS3 and Farseer.
I hope that answers all your main questions, at this point I can't provide much more info about the game ;)

But I will happily get back in touch with you as soon as we dug into Farseer , thanks for the offer!
Developer
Nov 17, 2008 at 7:30 PM
Very nice, I have just started school, but have been doing game/graphics programming for like 12 yrs now. I am going to school at Westwood College Online for a bachelors in Game Software Development. I can't provide much info on my game either as it's a really more of a programming skills demo then a game. The reason I am trying to add SAT-based collisions is to enable realtime geometry creation/destruction. Best of luck with your project.