trying this command again and can still not understand how to make it do as I think it should work.
where I expect two boxes I end up with three and one of them is the same object in two places. plus I can not pick it with pick object like I should be able to.
anybody want to have ago at seeing if they can make it work right.
Rem Project: phy3
Rem Created: 01/06/2008 18:53:38
Rem ***** Main Source File *****
Rem Project: phypully1
Rem Created: 07/08/2006 01:14:57
Rem ***** Main Source File *****
phy start
sync on
sync rate 0
autocam off
position camera 0,0,0,-150
jointID=1 :rem , identification number of the joint
rigid_body_a = 1 : rem first rigid body to be attached
rigid_body_b = 2 : rem second rigid body to be attached
x1#=0.0
y1#=0.0
z1#=0.0
x2#=100.0
y2#=100.0
z2#=0.0
x3#=0.0
y3#=100.0
z3#=0.0
x4#=0.0
y4#=0.0
z4#=0.0
distance#=20.0
stiffness#=100.0
ratio#=100.0
rem floor
make object box 10,100,1,100
position object 10,0,-40,0
phy make rigid body static box 10
make object cube 1, 10
position object 1, -10, 0, 0
phy make rigid body dynamic box 1
phy set rigid body mass 1, .1
make object cube 2, 10
position object 2, 10, 0, 0
phy make rigid body dynamic box 2
`phy make pulley joint 1, 1, 2
phy make pulley joint jointID, rigid_body_a, rigid_body_b, x1#, y1#, z1#, x2#, y2#, z2#, x3#, y3#, z3#, x4#, y4#, z4#, distance#, stiffness#, ratio#
`phy set pulley joint global axis 1, 0, 1, 0, 0
`phy set pulley joint global axis 1, 0, 1, 0, 0
phy build pulley joint 1
do
text 0,0,str$(cursorobj)
gosub _drag_object
control camera using arrowkeys 0,.1,.1
phy update
sync
loop
_drag_object:
if mouseclick()=0 then pickmode=0 : cursorobj=0
mclick=mouseclick()
if mclick>0
if pickmode=0
cursorobj=pick object(mousex(),mousey(),1,10)
if cursorobj>0
pickmode=mclick
pickdistance#=get pick distance()
pickfromx#=get pick vector x()
pickfromy#=get pick vector y()
pickfromz#=get pick vector z()
if pickmode=1
objx#=object position x(cursorobj)
objy#=object position y(cursorobj)
objz#=object position z(cursorobj)
else
objx#=object angle x(cursorobj)
objy#=object angle y(cursorobj)
objz#=object angle z(cursorobj)
pickdiffx#=mousemovey() : pickdiffx#=0
pickdiffy#=mousemovex() : pickdiffy#=0
endif
else
highlightobj=0
endif
endif
if pickmode>0
if pickmode=1
pick screen mousex(),mousey(),pickdistance#
picktox#=get pick vector x()
picktoy#=get pick vector y()
picktoz#=get pick vector z()
pickdiffx#=picktox#-pickfromx#
pickdiffy#=picktoy#-pickfromy#
pickdiffz#=picktoz#-pickfromz#
grid=0
if grid=1
pickdiffx#=int(pickdiffx#/5)*5
pickdiffy#=int(pickdiffy#/5)*5
pickdiffz#=int(pickdiffz#/5)*5
endif
`position object cursorobj,objx#+pickdiffx#,objy#+pickdiffy#,objz#+pickdiffz#
phy set rigid body position cursorobj,objx#+pickdiffx#,objy#+pickdiffy#,objz#+pickdiffz#
else
pickdiffx#=pickdiffx#+mousemovey()
pickdiffy#=pickdiffy#+mousemovex()
grid=0
if grid=1
tpickdiffx#=int(pickdiffx#/22.5)*22.5
tpickdiffy#=int(pickdiffy#/22.5)*22.5
else
tpickdiffx#=pickdiffx#
tpickdiffy#=pickdiffy#
endif
` rotate object cursorobj,wrapvalue(objx#-tpickdiffx#),wrapvalue(objy#-tpickdiffy#),objz#
phy set rigid body rotation cursorobj,wrapvalue(objx#-tpickdiffx#),wrapvalue(objy#-tpickdiffy#),objz#
endif
endif
endif
return
edit updated code so pick object works.
Dark Physics makes any hot drink go cold.