#### Archived

This topic is now archived and is closed to further replies.

# Semi circle collition help.

This topic is 5295 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I can do ray collition and I can do radius collition. But how do I do a semi circle collition.(EX. Swing of a sword.. Detect every mesh that the sword hits.) Any tips?

##### Share on other sites
Why don''t you just check if the mesh is on the right side of the circle, (you can use a dot product for this I''m pretty sure) and then check for distance (radius). That should get you what you need. It''s just a 2-step process.

##### Share on other sites
I tried that it didnt work real well it works fine if the character is facing down a axis but when i try this when its on an angle like let say 45 degrees it will only take the top half and is on the extreme left of the swing.... Is it possiable to track a movement of 1 mesh (the sword) and return a linklist or something like that of all the meshs that the mesh goes through.. my question with that is tho is how do you determine the hit if a object hits a odd shaped objects.

##### Share on other sites
Here''s what you need to do as an exact formula:

Let v = the vector that represents the direction that you''re facing, or the middle of your swing.

Let u = the vector from the point of swing to the point you want to test.

if u dot v is > 0, then it is on the side of the circle representing your swing that you want.

THEN

if the distance between your centre of swing, and the point you are testing is less than the radius of your swing, then that point is getting hit.

There you go, that''s what you need to know. You might want to look up a good book about linear algebra and matrices. I''d suggest "Linear Algebra and its Applications, Third Edition" by Davic C. Lay.

Any questions, just write back.

##### Share on other sites
I almost forgot to say this. If the bounding boxes don''t intersect, then they aren''t going to hit at all. Also, if the bounding boxes interesct, then you''d probably want to test all of the vertices to make it very accurate. You could probably get by checking only every second vertex assuming that your model is fairly detailed, and not spiky.

##### Share on other sites
Thanks that helps alot. I know where to go from here thanks.

1. 1
2. 2
3. 3
Rutin
17
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633660
• Total Posts
3013218
×