Skip to main content
35 votes
Accepted

How to make sure spinning objects hit a target with the right end?

Fake it Look at the video you linked, watch it in slow motion... eh, what is that? The camera jumps at the end, and the knife is already in the helmet of the target. Just fake it. Once the distance ...
Theraot's user avatar
  • 27.2k
14 votes

How to make sure spinning objects hit a target with the right end?

If you know ahead of time where the knife will land - like in those kill cam footage, which is most definitely produced after-the-fact - just calculate the right rotation speed based on flight ...
congusbongus's user avatar
  • 14.8k
14 votes

How to make sure spinning objects hit a target with the right end?

Calculate the straight line distance to target. Each Frame set the angle of the knife to be 2PI*(remainingStraightLineDistance)/(originalStraightLineDistance)*DesiredNumRotations. The spin ratio will ...
Tim B's user avatar
  • 556
4 votes
Accepted

Determining the first future intersection possible between ships and a planet

I don't think a purely analytical solution to this is possible. Any way we slice it, we have part of the problem in polar coordinates and another part in cartesian coordinates. So we end up trying to ...
DMGregory's user avatar
  • 135k
4 votes

How to make sure spinning objects hit a target with the right end?

Real throwing-knifes are designed to have a very high chance of hitting blade-first. Design your knives accordingly. Collection of throwing knives from Wikipedia: You want the center of mass, and ...
dotancohen's user avatar
2 votes

2D moving sprites collision

Check out this source. I wrote the code below based off of it to make it more friendly for a C# application. This works with convex polygons as well which might be a little overkill for you, ...
Eric's user avatar
  • 783
2 votes

How to make sure spinning objects hit a target with the right end?

For a "smoke and mirrors" way, you can have the center of rotation of the knife (i.e. the center of mass) near to the handle (i.e. non-pointy part). This way, if the rotation speed is high enough ...
Guido's user avatar
  • 121
1 vote
Accepted

Collision avoidance not only AI wrong

I found out logical mistake, I should do the sum of angles as totalAngle and then divide it by the count of angles so I get ...
durisvk10's user avatar
  • 243
1 vote
Accepted

Ensure a path always exists between moving objects

Note: I am not looking for any type of cooked solution, just some references to existing algorithms, implementations,... to look into by myself. A noteworthy algorithm here is Velocity_obstacle. Its ...
Mangata's user avatar
  • 2,581
1 vote

Wall sliding in JavaScript; works, but gets stuck at corners

You're not handling line endpoints correctly. Consider only a single line segment. The collision of a circle at the endpoint of a single line segment should be rounded, right? Like, if you trace out ...
John Haggerty's user avatar
1 vote
Accepted

Dodge different type of obstacles

I made it :D Using A* with time dimension. Creating the obstacle paths just one time, on cast. Then i simply do A* and on neighbor check i check for the time the spot would have as well, if a spot is ...
LuaNoob's user avatar
  • 161
1 vote

Collision detection in Arkanoid-like game at intersections

I'd recommend thinking of your blocks as a regular grid, with a fixed spacing horizontally & vertically. We'll use componentwise division to divide these spacing parameters out of both our ...
DMGregory's user avatar
  • 135k
1 vote

Collision detection in Arkanoid-like game at intersections

Solution 1 is to set your game in a universe of discrete pixels. Solution 2 is to include the decimals of the right and underneath the blocks in the blocks area. Let's say this is one block: It is ...
Lord Wolfenstein's user avatar
1 vote

2d Rectangle Collision Resolution: Find rollback point

What you're looking for is called swept or dynamic AABB collision detection. When dealing with a static and a dynamic (moving) object, you need to take the velocity of the latter in both x and y axes ...
Bálint's user avatar
  • 14.9k
1 vote

How to make sure spinning objects hit a target with the right end?

Perfect knife thrower? At the moment, you say you are spinning the knife through animation. What parameter are you using to control the angle? Frame number? Game time? Scaled by an arbitrary spin ...
Neil_UK's user avatar
  • 119
1 vote

Java 2D Game: Collision help

Ok, I finally found the solution! I made a hitbox for the x-axis so the x wouldn't interfere with the y. (by subtracting 10 from the y and 20 from the height) Now collisions are working abosolutely ...
shepgoba's user avatar
1 vote

2D moving sprites collision

You just need to compare sidelines. These are the algebraic representations of vertical or horizontal lines. Note, this will return only the current value, not what will be, but from here is only one ...
Lasoloz's user avatar
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible