Exact position of collision
Hi,
I'm making a app to the university. In it, I need create a mirror image (the mirror rotates in origin of cartesian plane and a reflected image appears) in other side.
Well, I'm using actives for simulate the rotation, but I need calculate the distance between the real image and the exact point where the two actives intersect (see the image attached) to discover the distance between the mirror and the reflected image.
Anybody knows how to do make it?
[img:center]http://img26.imageshack.us/img26/2496/61380718.jpg[/img]
Re: Exact position of collision
Can you not use the X,Y of each object? Where you set the hot spot will be the X,Y positions.
Marv
Re: Exact position of collision
I'm not sure I understand the problem completely. Are you trying to find the distance between a line and a point?
This might help:
http://www.ahristov.com/tutorial/geometry-games/point-line-distance.html
Re: Exact position of collision
yes, but the problem is retrieve the point where two active collides. I need knows the coordinates (in relation of your body ) where it collides with another object
Re: Exact position of collision
Well, Pharanygitis made the Advanced Collision object, which should do that, but it's Flash-only. Maybe someone could convert it?
Re: Exact position of collision
The way collisions are optimized, they could not return 'exact collision positions'. If I guess correctly how it was done, it will first cull the pixels that are not in the same X/Y bounds, then iterate over the remaining ones, from topleft to bottomright one line or column at a time, and when it hits a collision, it will stop and not need to keep checking (I hope this is how its done).
If thats the case, you'd always get the first detected position of collision, not the average or 'exact' position, considering the frame-based r/e/p loop. So thats not feasible.
However, doing collisions like these can be found through doing loops of collision detection of your own. The reflection over a line can only be given if you know not just the position of collision, but also the angle of incidence, which needs the normal angle of the bitmap. If thats what you need, I have an article written about finding that same angle on a 2d collision map, over here;
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=207486#Post2074 86
For the matter of finding the position of the collision itself, it is usually best to imagine the colliding object as a single point, and check the collision mask, or a seperate detector object, on positions in a loop in the angle of your movement, to see when it collides and where.
Re: Exact position of collision
As far as I can tell, the problem has nothing at all to do with collisions.
It seems like you're just trying to do something like this:
https://skydrive.live.com/self.aspx/Public/Mirror.mfa?cid=b1e7ee094271bbda&sc=documents
Re: Exact position of collision
Thanks, Pixelthief. Your explanation help me in other project :D In this case, the example made by MuddyMole is exactly what I need. I need make only some adaptations. Thanks a lot, MuddyMole!