Line that reflects

Hi!

I have a simple straight line that is an image object (it has to be a image and not the built in line thing). I then have some mirrors spread around on the screen. Now to the problem, I want that the line gets reflected by the mirrors and the reflection should be at different angles depending on the rotation of the mirrors and if the line is comming from above, under, left or right of the mirror.

The reflected line should then be reflected by other mirrors and so on.

What is the easiest and best way to accomplish this?

Oskar [import]uid: 24111 topic_id: 11871 reply_id: 311871[/import]

Are the mirror objects rotated in Z (on the X and or Y axes)? And is your scene rendered in 3D perspective or orthographic?

Maybe a screen shot would help.
[import]uid: 58455 topic_id: 11871 reply_id: 43277[/import]

It’s a 2d perspective seen from above. [import]uid: 24111 topic_id: 11871 reply_id: 43278[/import]

Can you post a screen shot?

You could probably cheat and, when the object passes a mirror, create another object with the same image and same velocity that only displays in the mirror bounds, but I don’t know how to make it look real without doing some 3D math, which ain’t my forte. [import]uid: 58455 topic_id: 11871 reply_id: 43312[/import]

the angle should be easy to determine, as they will be fixed angles.

so use the rotation property of the image to set the rotation to the appropriate angle.

I am skipping out all the math here, you can find that on many sites if you search for it.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 11871 reply_id: 43320[/import]

I’m sorry that I can’t give you a screenshot cause I can’t access my computer in about a week (writing this on a iPhone) but a really good example is another game that is done with Corona that ibclude just this. Search for “reflection connection” and I think you will find it on youtube and also on this site. [import]uid: 24111 topic_id: 11871 reply_id: 43348[/import]