WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-16-2009, 12:19 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You won't be able to create a perfect circle using bezier paths. You are better off manually animating the object. Either way, the following modified version of your script will generate a path that is closer to a circle. It uses cubic bezier and you removes the duplicate control point at the end of the path:
Code:
import viz
import vizmat
import vizact
viz.go()

viz.add('tut_ground.wrl')
ball = viz.add('ball.wrl')

viz.MainView.move([0,3,-20])

path = viz.addAnimationPath()
positions = [ [0,1,10], [10,1,0], [0,1,-10], [-10,1,0] ]
for x,pos in enumerate(positions):
	cp = viz.addControlPoint()
	cp.setPosition(pos)
	path.add(cp,x+1)

path.loop(viz.CIRCULAR)
path.translatemode(viz.CUBIC_BEZIER)
path.computetangents()
path.setAutoRotate(viz.ON)

mylink = viz.link(path,ball)
path.play()

def PrintInfo():
	pc = ball.getPosition()
	print 'position: ', pc

	dist = vizmat.Distance(pc,[0,1,0])
	print 'distance: ', dist

vizact.ontimer(0,PrintInfo)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Start_position on animation path ptjt255 Vizard 1 08-24-2009 11:40 AM
Problems with interaction of vizact.turn and animation path Enlil Vizard 3 11-24-2008 04:23 PM
speed on animation path whj Vizard 8 11-17-2008 07:41 PM
Animation Path djdesmangles Vizard 2 06-11-2007 03:37 PM
Animation Path djdesmangles Vizard 0 06-06-2007 11:03 AM


All times are GMT -7. The time now is 03:18 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC