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,
[D3D11] Scoring based on collision
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,
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,
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement