|
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.
|
# ¿ Apr 7, 2011 23:42 |
|
|
# ¿ May 2, 2024 08:17 |
|
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.
|
# ¿ Apr 8, 2011 19:25 |
|
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.
|
# ¿ Apr 8, 2011 21:47 |
|
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.
|
# ¿ Apr 13, 2011 16:37 |
|
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.)
|
# ¿ Apr 13, 2011 16:47 |