#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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.
|
#3
|
|||
|
|||
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 |
#4
|
|||
|
|||
Sorry, I'm not sure I understand your question
|
#5
|
|||
|
|||
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 |
#6
|
|||
|
|||
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) 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) |
|
|
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 |