Tag Info

New answers tagged


I thought this would be an interesting challenge to test some of the math I learned in school, so here's what I figured out. This approach assumes each object can be considered a circle for collision purposes. Naturally a car isn't a perfect circle, but it could be used as an approximation. You could use more circles to fill the area of the car better if ...


You could approach the issue by evaluating delta position each frame and check if by moving another delta the collision would trigger. prevPos = pos; pos = newPos; deltaPos = prevpos - pos if(EnterCollision(pos+deltaPos)) //do stuff


The basic idea is that you extend your car's collision box, based on the current velocity of the car. If this extension collides with a car or with car's extension box, you can assume that there will be a collision, so you must have the car that is the most 'behind' to avoid the collision. There seem to be a nice article here. They use vectors, but you'd ...


I was misunderstanding the way vectors in SpriteKit are represented. The solution I used was: dx = (size.width / 2 - ball.position.x) * vel dy = (size.height / 2 - ball.position.y) * vel

Top 50 recent answers are included