14

How to create narrow collision detection between a player's melee weapon and an enemy

This question was put on hold for being too broad, so I edited the question and title, read the "How To Ask" multiple times for advice and re-read my edit until I felt it met the standards. However, my question is still on hold and has been now for 7 hours. What else can I do to improve that question?

3
  • 4
    The question to me still appears too broad and doesn't show enough of the fruits of your own efforts. If this were my problem and question, I'd research the heck out of the problem, then discuss what I've found, then show my own attempt based on what I've found, and then use that attempt to try to ask a much more specific and focused question. Commented May 21, 2019 at 1:21
  • @HovercraftFullOfEels I dunno, the current version of the question seems quite okay to me. I'm not sure how the OP could narrow it down further other than actually attempting what they can't do/don't know how to do and provide that attempt but that I guess would render the question useless. But yes, I could see how the original version of the question was closed.
    – Script47
    Commented May 21, 2019 at 1:23
  • 3
    @HovercraftFullOfEels "I'd research the heck out of the problem, then discuss what I've found, then show my own attempt based on what I've found" I already did plenty research, and came across the distance formula (as was included with the question). I also mentioned why this didn't work in the post and was specific enough to say that imagining an invisible line that will return True if something is hit directly. I can't think of any more detail I can add, especially since during my research I found this topic is very limited in terms of coverage.
    – NoIdea
    Commented May 21, 2019 at 1:33

1 Answer 1

10

The post looks good to me except title.

In general title should be about what you are trying to achieve and not what you think solution is - check What is the XY problem? for reasons. I'd go for something along the lines of:

  How to detect collision with sword and enemy (narrow sector unlike fireball)

Body should include

  • clear description what you want to achieve (check, also adding something like "causing damage to enemy in front of player" to first sentence may help)
  • what you've tried (check - code for distance check, attempt at raytracing)
  • why what you found did not work (sort of check - good explanation for distance one, very strange statement that raytracing does only work in 3d and no mentioning that you need to cast multiple rays for sector detection)
  • reiterate what you are looking for (check - asking about actual problem, not "how to use raytracing").
4
  • I was advised to edit the title to include raytracing as someone had suggested. I'm not entirely sure what ray tracing is, but the research and examples I found were all 3D related. As for the title suggestion I went ahead and edited the post's title as well as the various edits to the body.
    – NoIdea
    Commented May 21, 2019 at 2:36
  • @NoIdea I've edited your post a bit - see if it aligns with what you mean... Note that I don't see comment that says to "edit the title to include raytracing", there is one "Your title is completely off the topic based on your question" - which I read as "title of your post is totally different from what you are asking"... Maybe there was another now delete comment. Commented May 21, 2019 at 2:48
  • 2
    @NoIdea both raytracing and raycasting are terms that are to do with 3D graphics projection, they are indeed not related to your question about collision detection.
    – Gimby
    Commented May 21, 2019 at 9:03
  • @Gimby Yeah, that's what I thought. Do you know of an alternative in a 2D environment?
    – NoIdea
    Commented May 21, 2019 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .