Hi All
The rope that I am using comes from the demos in ragdoll, what I am looking for is away of stopping it acting like a bungee rope and more like a cord or chain.
Anyone got any idea.
Rem Project: Pubskittles1
Rem Created: 18/05/2008 11:38:37
Rem ***** Main Source File *****
sync on : sync rate 0 :
color backdrop rgb(0,0,0)
set text font "arial" : set text size 12
autocam off
position camera 0,-30,15,-56
rotate camera 0,0,0,0
phy start
`position camera 0,0,90,0
`rotate camera 0,90,0,0
makebaseframe()
makebaseboard()
makeskittles()
makeswingpole()
makeballandcord()
gosub _rope_make
do
if inkey$()="s"
position camera 0,-30,15,-56
rotate camera 0,0,0,0
endif
if inkey$()="a"
position camera 0,-30,90,0
rotate camera 0,90,0,0
endif
if upkey()=1
inc y
position camera 0,-30,15+y,-56
endif
if downkey()=1
dec y
position camera 0,-30,15-y,-56
endif
text 0,0,str$(object position x(1021))
text 0,10,str$(object position y(1021))
text 0,20,str$(object position z(1021))
gosub _drag_object
phy update
sync
loop
function makebaseframe()
rem base
make object box 1001,43,1,43
position object 1001,0,-10,0
color object 1001,RGB(128,128,64)
phy make rigid body static box 1001
rem back bar
make object box 1002,43,5,1
position object 1002,0,-8,21.5
phy make rigid body static box 1002
rem front bar
make object box 1003,43,5,1
position object 1003,0,-8,-21.5
phy make rigid body static box 1003
rem left bar
make object box 1004,1,5,43.2
position object 1004,-21.5,-8,0
phy make rigid body static box 1004
rem right bar
make object box 1005,1,5,43.2
position object 1005,21.5,-8,0
phy make rigid body static box 1005
endfunction
function makebaseboard()
make object box 1010,23,1.5,23
position object 1010,0,-8.5,0
rotate object 1010,0,45,0
phy make rigid body static box 1010
endfunction
function makeskittles()
y#=-1.6
make object cylinder 1020,9
scale object 1020,35,100,35
position object 1020,0,y#,0
clone object 1021,1020
position object 1021,12,y#,0
clone object 1022,1020
position object 1022,-12,y#,0
clone object 1023,1020
position object 1023,0,y#,-12
clone object 1024,1020
position object 1024,0,y#,12
clone object 1025,1020
position object 1025,6,y#,-6
clone object 1026,1020
position object 1026,-6,y#,6
clone object 1027,1020
position object 1027,6,y#,6
clone object 1028,1020
position object 1028,-6,y#,-6
for id = 1020 to 1028
phy make rigid body dynamic box id
phy set rigid body gravity id, 1
next id
endfunction
function makeswingpole()
make object cylinder 1030,75
position object 1030,-21.5,27,0
scale object 1030,2,100,2
phy make rigid body static box 1030
endfunction
function makeballandcord()
endfunction
_rope_make:
rem make bone representation
make object sphere 10,2
make object box 11,10,0.1,0.2
make mesh from object 11,11
add limb 10,1,11
offset limb 10,1,5,0,0
make mesh from object 10,10
delete object 11
delete object 10
make object 10,10,0
hide object 10
`
rem create rag doll rope
` load object "ropebones.X", 1
load object "C:\Program Files\Dark Basic Software\Dark Basic Professional\Projects\Dark Physics\Demos\Ragdoll\Rope\ropebones.x",1
position object 1,-22.5,65,0
rotate object 1,1,2,3
set object light 1,0
scale object 1,100,100,10
`
rem make seperate objects to represent the rope
objid=199
perform checklist for object limbs 1
cm=checklist quantity()
for c=1 to cm-1
`
rem info from bones
x#=limb position x(1,c-1)
y#=limb position y(1,c-1)
z#=limb position z(1,c-1)
rx#=limb direction x(1,c-1)
ry#=limb direction y(1,c-1)
rz#=limb direction z(1,c-1)
`
rem new obj
inc objid : if object exist(objid)=1 then delete object objid
`
rem only make capsules out of 'qualifying bones'
c$=checklist string$(c)
if c=1
rem make root object
make object cube objid,0.1
position object objid,x#,y#,z#
rotate object objid,rx#,ry#,rz#
phy make rigid body static box objid
else
if lower$(c$)<>"$noname$"
rem make capsule
make object box objid,10,1,1
position object objid,x#,y#,z#
rotate object objid,rx#,ry#,rz#
move object left objid,-5.0
phy make rigid body dynamic box objid
phy set rigid body mass objid,10
endif
endif
`
next c
`
rem JOINT SPECIFIC SECTION
rem join the seperate objects to make copy of the rope model
jid=0
for c=1 to cm-1
c$=checklist string$(c)
if c=1
link=c-1
else
if lower$(c$)<>"$noname$"
linkto=c-1 : a=200+link : b=200+linkto
inc jid : phy make revolute joint jid, a, b, 1, 0, 0, limb position x(1,linkto),limb position y(1,linkto),limb position z(1,linkto)
link=linkto
endif
endif
next c
rem add heavy ball to rope
make object sphere 150,3.7,30,30 : linkto=20
position object 150,limb position x(1,linkto),limb position y(1,linkto),limb position z(1,linkto)
color object 150,rgb(255,255,0)
set object emissive 150,rgb(128,128,0)
phy make rigid body dynamic sphere 150
phy set rigid body mass 150,30000
inc jid : phy make revolute joint jid, 150, 218, 1, 0, 0, limb position x(1,linkto),limb position y(1,linkto),limb position z(1,linkto)-3
`scale object 150,150,150,150
`
rem RAGDOLL SPECIFIC SECTION
rem set the model to become a ragdoll model, and use the 'base physics object - the first capsule'
phy make rag doll 1, 1, 200
rem assign ragdoll model limbs to point to real world jointed physics objects
phy assign rag doll part 1, 0, 17, 201
phy assign rag doll part 1, 0, 16, 202
phy assign rag doll part 1, 0, 15, 203
phy assign rag doll part 1, 0, 14, 204
phy assign rag doll part 1, 0, 13, 205
phy assign rag doll part 1, 0, 12, 206
phy assign rag doll part 1, 0, 11, 207
phy assign rag doll part 1, 0, 10, 208
phy assign rag doll part 1, 0, 9, 209
phy assign rag doll part 1, 0, 8, 210
phy assign rag doll part 1, 0, 7, 211
phy assign rag doll part 1, 0, 6, 212
phy assign rag doll part 1, 0, 5, 213
phy assign rag doll part 1, 0, 4, 214
phy assign rag doll part 1, 0, 3, 215
phy assign rag doll part 1, 0, 2, 216
phy assign rag doll part 1, 0, 1, 217
phy assign rag doll part 1, 0, 0, 218
`
rem hide physics objects controlling tagdoll model
for o=200 to 218 : hide object o : next o
`
return
`remend
_drag_object:
if mouseclick()=0 then pickmode=0 : cursorobj=0
mclick=mouseclick()
if mclick>0
if pickmode=0
cursorobj=pick object(mousex(),mousey(),150,150)
text 0,0,"object = "+str$(cursorobj):sync
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
phy set rigid body position cursorobj,objx#+pickdiffx#,objy#+pickdiffy#,objz#+pickdiffz#
phy set rigid body linear velocity cursorobj,objx#+pickdiffx#,objy#+pickdiffy#,objz#+pickdiffz#
`position object 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#
rotate camera 0,wrapvalue(objx#-tpickdiffx#),wrapvalue(objy#-tpickdiffy#),objz#
endif
endif
endif
return
Dark Physics makes any hot drink go cold.