Jump to content
  • Advertisement
Sign in to follow this  
TheRocket

[D3D11] Scoring based on collision

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I'm struggling to understand a way to implement a simple scoring system based of where the collision occurred. I currently have a ball (mesh sphere) hitting a target (sprite) using AABBs. The problems I'm trying to solve are:

1) How to avoid raising a collision for transparent sprites (i.e. my target is 256x256 and a majority of it is transparent)
2) How to detect where the ball hit the target and update the score accordingly (e.g. bullseye is worth more than outer edge)

I thought I could solve both these problems by creating a hit map which is basically color coded to indicated score (bullseye is red, outer edge is blue) that I would check during a collision. I thought I could use this same procedure to check the alpha to see if I had a legitimate collision.

I created a staging texture to hold my hit map but I don't think there is any way to transform the world-space coordinates of the collision into something useful that I can use to figure out what pixel in my hit map was hit.

Was I on the right track and is there a way to figure out the right coordinates in my hit map, or is there another way of doing this?

Thanks,

Share this post


Link to post
Share on other sites
Advertisement
OK so my plan was to grab the x,y,z in projection space of where ball is when a AABB collision is detected. What i'm stuck on is how do I get those coordinates into something useful.

If I unproject into the targets model space will that give me something I can then try to use? I tried it and it seems to give me garbage. Are there any articles on this? I found this thread http://groups.google.com/group/cocos2d-iphone-discuss/browse_thread/thread/f6e734e00d863f5e/41768952a1bcca0e?lnk=gst&q=image+mask&pli=1 which is basically what I want to do but i'm not sure why he is able to use the coordinates without performing any transformations.

Thanks,

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!