Python Forum
Object moving in a spiral
Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object moving in a spiral
#1
I'm having a hard time figuring out how to get an object (a ball in this case) to move in a spiral.  I figured the best way to go about this would be to use polar coordinates for x and z, but I can't seem to implement it properly.  Any ideas?

from visual import *

myuniv = display(range = vector(25,25,25))

theta = 1
r = 2
s = vector(r*cos(theta),2,r*sin(theta))  
v = vector(theta,0,theta)
a = vector(0,-9.8,0)

dt = 0.1
t = 0.0

ball = sphere(pos = s, radius = 0.25, color = color.cyan)

while s.y > -100.0:
    rate(25)
    theta = theta + 1
    s = s+ v*dt
    v = v + a*dt
    t = t + dt
    ball.pos = s
    ballghost = sphere(pos = s, radius = 0.2)
Am I on the right track here?  I'm very new to python and coding languages in general.

Thanks! Smile
Reply


Messages In This Thread
Object moving in a spiral - by JakeWitten - Apr-22-2017, 04:45 AM
RE: Object moving in a spiral - by nilamo - Apr-26-2017, 05:26 AM
RE: Object moving in a spiral - by Mekire - Apr-26-2017, 06:36 AM
RE: Object moving in a spiral - by nilamo - Apr-26-2017, 01:56 PM
RE: Object moving in a spiral - by Mekire - Apr-26-2017, 05:30 PM
RE: Object moving in a spiral - by JakeWitten - May-02-2017, 04:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Moving object in 3d plot jonathan2582 1 3,182 Dec-04-2019, 12:27 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020