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

#1 2010-09-01 21:25:14

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Slope Detection?

How can I accurately make a ball detect/roll on a slope?


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#2 2010-09-01 22:18:25

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Slope Detection?

If you are using straight line slopes...you can use separate sprites for each different slope and have them sense when the ball is touching them and set the slope that the ball uses.  That's how my Marble Kit project works  smile

Another approach is to actually measure the slope using some sensor sprites...but that usually takes a fair amount of time and adds lag to the project.  It's the best way to go, though, if you are dealing with an uneven surface.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2010-09-01 22:36:21

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Slope Detection?

Paddle2See wrote:

If you are using straight line slopes...you can use separate sprites for each different slope and have them sense when the ball is touching them and set the slope that the ball uses.  That's how my Marble Kit project works  smile

Another approach is to actually measure the slope using some sensor sprites...but that usually takes a fair amount of time and adds lag to the project.  It's the best way to go, though, if you are dealing with an uneven surface.

I just made slope sensors- side sensors that are a bit elevated. If they are touching a wall/color, they'll activate and add a bit to the velocity.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#4 2010-09-02 16:45:13

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: Slope Detection?

Check out this slope detection. It uses exactly what Sun-Rise Moon uses.
http://scratch.mit.edu/projects/project1/1234179

Offline

 

Board footer