WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-29-2016, 01:27 PM
haohaoxuexi1 haohaoxuexi1 is offline
Member
 
Join Date: Sep 2015
Posts: 81
Is that possible to create some connection between to sphere?

For example, I add two spheres into Vizard to represent the joints.

However, I want to create a line or some other things which can connect these two joints.

When the position of the joints change, the line will move follow the joints.

Thanks.
Reply With Quote
  #2  
Old 07-30-2016, 05:29 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You could create an on-the-fly line to connect the two spheres.
Reply With Quote
  #3  
Old 07-31-2016, 11:16 AM
haohaoxuexi1 haohaoxuexi1 is offline
Member
 
Join Date: Sep 2015
Posts: 81
Quote:
Originally Posted by Jeff View Post
You could create an on-the-fly line to connect the two spheres.
Code:
import viz,vizact,vizshape, vizmat

viz.go()
grid = vizshape.addGrid() 

sphere_0_left = vizshape.addSphere(radius=0.1)
sphere_1_left = vizshape.addSphere(radius=0.1)
So how to connect this two sphere using on the fly
Reply With Quote
  #4  
Old 07-31-2016, 07:00 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
If you want to draw a line, create a layer with viz.lines and use the center point of each sphere as a vertex. You can update the vertex positions as the sphere positions change.
Reply With Quote
  #5  
Old 08-01-2016, 09:56 AM
haohaoxuexi1 haohaoxuexi1 is offline
Member
 
Join Date: Sep 2015
Posts: 81
Quote:
Originally Posted by Jeff View Post
If you want to draw a line, create a layer with viz.lines and use the center point of each sphere as a vertex. You can update the vertex positions as the sphere positions change.
in that way, the system will repeat drawing the line as many as the times of position changes.

is there a way to draw one line and keep updating the position
Reply With Quote
  #6  
Old 08-02-2016, 06:03 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Yes, once you create the line you can move it like any other object:

Code:
import viz
import vizshape

viz.go()

viz.clearcolor(viz.SLATE)
vizshape.addGrid()

viz.startLayer(viz.LINES) 
viz.vertex(0,0,0)  
viz.vertex(0,1,0) 
line = viz.endLayer() 

line.setPosition([2,0,7])
line.color(viz.RED)
Reply With Quote
  #7  
Old 08-02-2016, 09:11 AM
haohaoxuexi1 haohaoxuexi1 is offline
Member
 
Join Date: Sep 2015
Posts: 81
Quote:
Originally Posted by Jeff View Post
Yes, once you create the line you can move it like any other object:

Code:
import viz
import vizshape

viz.go()

viz.clearcolor(viz.SLATE)
vizshape.addGrid()

viz.startLayer(viz.LINES) 
viz.vertex(0,0,0)  
viz.vertex(0,1,0) 
line = viz.endLayer() 

line.setPosition([2,0,7])
line.color(viz.RED)
Is there a way to change the position of line only by change the vertex of it?

In the code you gave to me, the length of the line is fixed, is that possible to get a line which will change its length according to the position of vertex?
Reply With Quote
  #8  
Old 08-08-2016, 01:43 PM
haohaoxuexi1 haohaoxuexi1 is offline
Member
 
Join Date: Sep 2015
Posts: 81
Quote:
Originally Posted by Jeff View Post
Yes, once you create the line you can move it like any other object:

Code:
import viz
import vizshape

viz.go()

viz.clearcolor(viz.SLATE)
vizshape.addGrid()

viz.startLayer(viz.LINES) 
viz.vertex(0,0,0)  
viz.vertex(0,1,0) 
line = viz.endLayer() 

line.setPosition([2,0,7])
line.color(viz.RED)
can you help me to solve my last question?
Reply With Quote
  #9  
Old 08-08-2016, 09:59 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Yes, you can modify vertices to change the length of the line. Take a look at the changing vertices page from the on-the-fly section. Does this help answer your question?
Reply With Quote
  #10  
Old 08-09-2016, 01:48 PM
haohaoxuexi1 haohaoxuexi1 is offline
Member
 
Join Date: Sep 2015
Posts: 81
Quote:
Originally Posted by Jeff View Post
Yes, you can modify vertices to change the length of the line. Take a look at the changing vertices page from the on-the-fly section. Does this help answer your question?
fixed it, thanks
Reply With Quote
Reply


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
Create object with position relative to user head, but cannot be obstructed by others Notch Vizard 2 03-03-2014 07:16 AM
Create a clipping box pswaney Vizard 1 03-01-2013 12:19 PM
How to create AMTI AccuGait force plate plug-in using serial port connection? manueleh Plug-in development 0 09-20-2012 01:22 PM
Dynamic Position and Radius of Sphere hotshotiguana Vizard 1 03-23-2011 12:53 PM
Create Button or Text Chrissy2009 Vizard 1 07-15-2009 05:34 PM


All times are GMT -7. The time now is 04:03 PM.


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