Rolling down a Curve

73 views
Skip to first unread message

Refath Bari

unread,
Feb 17, 2021, 2:33:16 AM2/17/21
to Glowscript Users
Hi, I'm trying to make a program where the user can
  1. Make two points
  2. Draw a curve between the points
  3. Have a ball roll down the curve drawn
  4. Print the time it took for the ball to roll down from A to B
I've completed #1 and #2. However, to have my ball roll down the curve drawn by the user, I think I need to access the points in the "trail" of the yellow marker. How can I do so? If I can't, is there any other alternative? Thank you for the help. The code is here

Roll.png

Refath Bari

unread,
Feb 17, 2021, 5:45:39 AM2/17/21
to Glowscript Users
Update: I've used for i in range (3,len(scene.objects)-1) to create hundreds of little points. I fed those points into a curve, and now an actual curve is generated from the user's drawing. Here's my plan: treat each of the segments of the curve as a cylinder, and then use some Lagrangian Mechanics to simulate the motion of the ball down the curve like a bead down a wire. Please let me know what you thin or if there is a better alternative. Thank you. RollMan.png

Bruce Sherwood

unread,
Feb 17, 2021, 11:00:35 AM2/17/21
to Glowscript Users
Here is a somewhat similar program:


You might wish to represent the curve using a curve object rather than a large number of cylinders:


Bruce

Refath Bari

unread,
Feb 17, 2021, 11:17:15 AM2/17/21
to Glowscript Users
Thank you for your response. Yes, I already have the object as a curve. Now I have a better idea. No need for Lagrangian Mechanics; Just treat each cylinder like an inclined plane with a=gsinø!

Paul Camp

unread,
Feb 18, 2021, 5:04:30 PM2/18/21
to glowscri...@googlegroups.com
I had a similar problem when figuring out some replacements for online classes -- an inclined plane in which the angle gradually changes. My strategy was similar to yours but it had a weird bug -- the cart kept falling through the track. It took a while to find the logic error. When I stepped forward in time, I forgot to rotate the direction of the velocity vector to the new angle. If you're having your program compute the net force, that shouldn't be a problem but if you're trying to do it kinematically, don't do what I did.


--

---
You received this message because you are subscribed to the Google Groups "Glowscript Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glowscript-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/glowscript-users/639c3716-9975-4e43-8c1f-7b65b55b1feen%40googlegroups.com.


--
Dr. Paul J. Camp

"The beauty of the cosmos derives not only from unity in variety
       but also from variety in unity"
                 -- Umberto Eco
                     The Name of the Rose
Reply all
Reply to author
Forward
0 new messages