This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-12-17 12:50:01

Dan01
Scratcher
Registered: 2008-06-11
Posts: 100+

Using Mirrors in Scratch

How could you reflect a beam of light of a mirror, as it would in real life; using incident ray, reflected ray and a normal.

Any help would be great. Any questions just ask.


http://img3.imageshack.us/img3/4743/ubd6522wp8.png
http://img3.imageshack.us/img3/4667/ubd3758ox2.png

Offline

 

#2 2008-12-17 12:51:40

Dan01
Scratcher
Registered: 2008-06-11
Posts: 100+

Re: Using Mirrors in Scratch

I've tried:

<point in direction( (( Direction of Sprite 1 <-> 180 ))

But it didn't look right.


http://img3.imageshack.us/img3/4743/ubd6522wp8.png
http://img3.imageshack.us/img3/4667/ubd3758ox2.png

Offline

 

#3 2008-12-17 14:28:30

mrweston
Scratcher
Registered: 2007-12-13
Posts: 100+

Re: Using Mirrors in Scratch

Try the other way around: 180 - (direction of Sprite)

smile

Offline

 

#4 2008-12-17 15:39:33

Dan01
Scratcher
Registered: 2008-06-11
Posts: 100+

Re: Using Mirrors in Scratch

mrweston wrote:

Try the other way around: 180 - (direction of Sprite)

smile

I'm sure that's right, but it doesn't work... But I think there's something wrong with Scratch rather than the calculation because:

Say the direction of sprite 1 is -45 and when the light touches sprite 2, it does:

180 - -45 which is 225 by my calculations.

But Scratch gives a completely diferent answer.

Can anyone see why?


http://img3.imageshack.us/img3/4743/ubd6522wp8.png
http://img3.imageshack.us/img3/4667/ubd3758ox2.png

Offline

 

#5 2008-12-17 16:42:49

TheSaint
Scratcher
Registered: 2008-11-04
Posts: 1000+

Re: Using Mirrors in Scratch

Have it move five steps in that direction directly after otherwise it is still touching the object.

Offline

 

#6 2008-12-17 17:32:05

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

Re: Using Mirrors in Scratch

Dan01 wrote:

mrweston wrote:

Try the other way around: 180 - (direction of Sprite)

smile

I'm sure that's right, but it doesn't work... But I think there's something wrong with Scratch rather than the calculation because:

Say the direction of sprite 1 is -45 and when the light touches sprite 2, it does:

180 - -45 which is 225 by my calculations.

But Scratch gives a completely diferent answer.

Can anyone see why?

The answer will be negative, because Scratch only supports directions between -180 and 180.

Offline

 

#7 2008-12-18 14:44:45

mrweston
Scratcher
Registered: 2007-12-13
Posts: 100+

Re: Using Mirrors in Scratch

Exactly. The correct opposite of -45° is 45°. When we do 180° - (-45°), we get 225°. But then when you drop that answer into a Direction block, it "wraps" the number around within the -180-to-180 system: i.e., since it can't be larger than 180°, it wraps to zero, then counts from there. So 225° becomes 45°.

Does that help?  smile

Offline

 

#8 2008-12-18 16:15:54

Dan01
Scratcher
Registered: 2008-06-11
Posts: 100+

Re: Using Mirrors in Scratch

mrweston wrote:

Exactly. The correct opposite of -45° is 45°. When we do 180° - (-45°), we get 225°. But then when you drop that answer into a Direction block, it "wraps" the number around within the -180-to-180 system: i.e., since it can't be larger than 180°, it wraps to zero, then counts from there. So 225° becomes 45°.

Does that help?  smile

Yea. Thanks to everyone that posted  big_smile


http://img3.imageshack.us/img3/4743/ubd6522wp8.png
http://img3.imageshack.us/img3/4667/ubd3758ox2.png

Offline

 

Board footer