WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-13-2009, 02:49 PM
minawageh minawageh is offline
Member
 
Join Date: Mar 2009
Posts: 6
Post New project need HELP

i'm working on big project i need help in a lot of things
first i need to move parts with mouse and assemble them to each other so i tried to make snap function like in 3d's programs but i can't get it so
can any one help me how to get 2 objects aligned when they r close
Reply With Quote
  #2  
Old 03-13-2009, 04:18 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You could keep track of both objects' positions. Once they are in a certain range of eachother set one to be the parent of the other and set the child's position so it has the correct offset to appear aligned. Then when you move the parent object the child will move with it.
Reply With Quote
  #3  
Old 03-14-2009, 01:45 PM
minawageh minawageh is offline
Member
 
Join Date: Mar 2009
Posts: 6
thats wot work for me because i wanna align them but in the same time allaow user to move it along axis

i tried to draw a line using vertex commands but i cant get its position
so if you have onther idea how to do this pls tell me
thx
Reply With Quote
  #4  
Old 03-16-2009, 11:18 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Sorry, I'm not sure I understand your question
Reply With Quote
  #5  
Old 03-16-2009, 02:13 PM
minawageh minawageh is offline
Member
 
Join Date: Mar 2009
Posts: 6
Quote:
Originally Posted by Jeff View Post
Sorry, I'm not sure I understand your question
ok don't warry about that i tried your suggestion and it works but i have anather problem i want an object is close enough to be child it not allawed to move in all directions in other words i want the object to move only in one axis (x for example) so it only sliding along this axis
and thx again
Reply With Quote
  #6  
Old 03-17-2009, 04:17 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
If you want to move your object with the mouse along just the x-axis you could either translate mouse movement into object movement with something like this
Code:
#Disable mouse navigation
viz.mouse(viz.OFF)

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

def mymouse(e):
    #Move the object based on the mouse position
    ball.setPosition((e.x-0.5)*6,2,8)

viz.callback(viz.MOUSE_MOVE_EVENT, mymouse)
or you could move the object with the mouse buttons
Code:
#Disable mouse navigation
viz.mouse(viz.OFF)

ball = viz.add('ball.wrl', pos = [0,2,8])

#use buttons to control ball
vizact.whilemousedown(viz.MOUSEBUTTON_LEFT, ball.translate,vizact.elapsed(-1),0,0,viz.REL_PARENT)
vizact.whilemousedown(viz.MOUSEBUTTON_RIGHT, ball.translate,vizact.elapsed(1),0,0,viz.REL_PARENT)
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
Sharing Files on SourceForge farshizzo Vizard 1 09-03-2012 12:18 PM
Need help with a project mberkes Vizard 14 05-27-2009 12:54 PM
Project .avi or .mpeg file pattie Vizard 2 02-06-2007 09:09 AM


All times are GMT -7. The time now is 08:32 PM.


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