Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » I'm making a pendulum which moves with the mouse
- quangdieu
- Scratcher
4 posts
I'm making a pendulum which moves with the mouse
I'm new to physics on scratch, can somebody help me
- Scratch-Minion
- Scratcher
1000+ posts
I'm making a pendulum which moves with the mouse
You could draw your pendulum costume with the pivot point (ie. the top) of the pendulum at the centre of the pendulum costume.
Then you could use:
Then you could use:
forever
point towards [mouse-pointer v]
end
- quangdieu
- Scratcher
4 posts
I'm making a pendulum which moves with the mouse
what about the gravity
i'm stuck with making the gravity
i'm stuck with making the gravity
Last edited by quangdieu (May 15, 2020 07:50:38)
- PutneyCat
- Scratcher
500+ posts
I'm making a pendulum which moves with the mouse
As per @Scratch-Minion, draw the pendulum with the top of the pendulum at the centre of the costume.
Draw the rest of it horizontally to the right, rather than down (works better with the script below).
Then this may be along the lines of what you want:
Draw the rest of it horizontally to the right, rather than down (works better with the script below).
Then this may be along the lines of what you want:
forever
if <mouse down?> then
set [angular speed v] to [0]
point towards [mouse pointer v]
else
change [angular speed v] by ([sin v] of (direction))
turn cw (angular speed) degrees
end
end
Last edited by PutneyCat (May 15, 2020 10:37:35)
- Discussion Forums
- » Help with Scripts
- » I'm making a pendulum which moves with the mouse