Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
sevenflow
Jun 28, 2003
just watch it for a second
First app is out on the store today: http://itunes.apple.com/us/app/jetsetter-for-ipad/id416813861?mt=8&ls=1

It's an an iPad app for Jetsetter, the travel company I work for. Features include 360 degree panoramic photos, animation universe (!), full screen photos in both orientations by cropping to photographer defined interest points, and a lot of other stuff that could be dangerous in hands like mine. There are many ways this could break, though I hope most of them have been fixed. If you have a moment and enjoy travel, please try and break it.

Adbot
ADBOT LOVES YOU

sevenflow
Jun 28, 2003
just watch it for a second
There's some useful information on the web (http://stackoverflow.com/questions/1354472/detect-if-line-segment-intersects-square should work in Objective-C), but basically you just need to check if a line (representing the path) intersects a rectangle (representing the obstacle) before you start moving. It's a little more complicated if the objects move but the basic idea is the same.

sevenflow
Jun 28, 2003
just watch it for a second
In that case you can project where the object will be at the time of intersection, or you can just run the check every time your logic loop fires while the player is moving. It's not an expensive operation so you shouldn't run into any issues.

sevenflow
Jun 28, 2003
just watch it for a second

NOG posted:

edit: Even better... I think CGRectIntersectsRect will solve the issue even more. Still just thinking it out but for some reason I think this will be a smart choice.

The only issue with this is that you won't be able to really project before hand, you'll have to test on every frame. Which is fine, it's a really cheap operation.

sevenflow
Jun 28, 2003
just watch it for a second
Yeah, I think it is in most cases. He wasn't entirely clear as to how he was using it, though, so I was just wondering if maybe he was doing pathfinding or something similar and wanted to pre-check if the path was feasible before the player ever moved. For a platformer or the like it's ideal.

You could also go with something like Box2D for collision detection, even if you're not using it for physics simulation. It has a lot of nice functionality built in for testing these types of things (eg. it'll let you project the path of an object and let you know all the objects it will collide with on the way.)

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply