Posted: 18th May 2003 14:44
[edit] updated code below
Posted: 19th May 2003 14:45
[edit] Next one
Posted: 20th May 2003 18:06
Updated it to make it simpler to use, just save this code in a directory with some rigged models without animation:

+ Code Snippet
`Simple Skeletal system test by James Masson
`20/05/03
`DBpro demo
`Mouse 2 selects bone
`Mouse x rotates object
`Mouse 1+move x/y rotates selected limb/bone in the x/y dimensions
`Spacekey moves the object in the direction it faces
`Esc to exit

sync on
hide mouse
color backdrop 0
backdrop off
getfile:
print "Input name of rigged .x model:"
input filename$
if file exist(filename$+".x")=1
   load object filename$+".x",1
   while limb exist(1,l)=1
      inc l
      inc max_limbs,1
   endwhile
   dec max_limbs,1
else
   print "Could not load object, try again"
   goto getfile
endif
backdrop on
autocam off
make object cube 2,1
ghost object on 1
ghost object on 2
do
if mouseclick()=2 then mc2=1
if mc2=1 and mouseclick()=0
   mc2=0
   inc ls,1
   if ls>max_limbs then ls=0
endif

if mouseclick()=1
   l_xrot#=wrapvalue(limb angle x(1,ls)+mousemovey())
   l_yrot#=wrapvalue(limb angle y(1,ls)+mousemovex())
   rotate limb 1,ls,l_xrot#,l_yrot#,limb angle z(1,ls)
else
   ry#=wrapvalue(ry#+mousemovex())
   yrotate object 1,ry#
endif

position object 2,limb position x(1,ls),limb position y(1,ls),limb position z(1,ls)
rotate object 2,limb angle x(1,ls),limb angle y(1,ls),limb angle z(1,ls)

if spacekey()=1 then move object 1,-0.05

set cursor 0,0
for l=0 to max_limbs
 if limb exist(1,l)=1
   l$=limb name$(1,l)
   if l=ls
      ink rgb(255,0,0),0
   else
      ink rgb(255,255,255),0
   endif
   print str$(l)+": "+l$
 endif
next l
center text 320,460,"Esc to exit"
sync
loop
delete object 1
delete object 2
end


I'd really appreciate it if someone would try this in patch 4.1 and let me know if the mesh deforms around the bones

and here's a rigged model to test it with if you don't have one, so there's no excuse!!
http://www.freewebs.com/danmatsuma/testc.x
Just save the stoopid cylinder in the same directory as the project, start the program type:

testc

or the name of an .x model of your own which has no animation data

then try scrolling through the joints/limbs/bones whatever you want to call them (rightclick) and then leftclick/drag the mouse to attempt realtime deformation of the mesh.

Move the mouse left/right without clicking to rotate the model.
Press space to move the model.

Please take note if the limbs move with the model (I know bone 0 does, but I'm interested in the others)

Of course you can always just use it as a stoopid model viewer too
Posted: 20th May 2003 21:46
Works for me.

Tested it on a fairly complex chopper model I made and each limb rotates independantly of the main model - is that what you wanted to know?
Posted: 21st May 2003 11:16
No I want to know if it works on a static mesh, with bones. I posted one for download if you could try it with that in patch 4.1, I can't as I'm still waiting for my full version of pro to arrive, so this was coded in the demo.

I'm assuming your helicopter is made of seperate pieces, and so it's not really the test I was looking for, It'll definitely work on seperately limbed models even in db 1.13 I imagine... But thanks for tryin' anyhow

What I'm trying to find out is if I can develop with patch 4.1 in mind, as the demo has a rather horrid bug which stops rotate limb commands from deforming the mesh the limbs are attached to, and also stops the skeleton from moving with the model. Lee assured me this is fixed in 4.1 and so I'm asking people to test it while I wait for pro(You can't patch the demo)
Posted: 21st May 2003 14:41
I tested your .x model (using 1.41). I get a cube and whichever limb is selected it is always the same cube that rotates. Don't know if this is good or bad.
Posted: 22nd May 2003 7:40
I'm confsed as to which version of Darkbasic you're using, The test is for DarkBASIC Professional patched to 4.1 and the test is to see whether the mesh deforms with the little cube's rotation. If you used this in pro the cube would move to the axis of each bone(or limb) in the list each time you click the right mouse button.

If the test worked, you would see the cylinder deform quite dramatically as you leftclick/dragged the mouse, the little cube is just to reveal the location of the invisible bone(or limb) and acts as a kind of 3d cursor.

If it failed, you are either using DarkBASIC 1.xx(classic) or the demo, or at worst, software control of mesh deformation using limb commands is impossible (that's kind of what I'm trying to test here, wether patch 4.1 fixes this bug)
Posted: 22nd May 2003 15:18
lol sorry I'm getting my numbers mixed up with all the other countless patched programmes that I use!

4.1 is what I used. All I saw was a cube that would spin around in the same manner no matter what limb was selected. You say the "cylinder" would deform - I didn't even see a cylinder! You also say "little cube" - the cube practically fills the entire screen!

Ok so you know I'm not going mad, here's a screenshot...
Posted: 22nd May 2003 15:37
I did try it on another boned model of my own, although it didn't consist of one single mesh. For the record this is what it showed (note i removed the text as the number of lines was overflowing off end of screen and causing problems)



It's quite small but you can just make out by his groin, the little white cube. So this cube spins away happily depending on the selected limb but i get no deformations. Maybe this is expected since the model is not a single mesh.
Posted: 24th May 2003 13:58
Sounds like the camera got too close to the cube, and was inside the cylinder, See I have a load object command, the camera should automatically move/adjust fov for that model. Now I set autocam off and create the cube. I don't know why but I'm guessing those commands also work differently in patch 4.1.
Which is upsetting! But the cylinder model (testc.x)really should work

The mesh should only deform if it's a static (one-piece) mesh, which has had bones added (joints in milkshape) and been rigged before being loaded into DBpro. Also, the object should have no animation data. If you use a model with seperate linked limbs, the program wasn't really designed for that, but it should still rotate whatever body part is selected. But if that's all I needed I would have stuck with DB 1.13/enhanced. It's really the mesh deformation I need to know about, for a project I'm working on

Your testing does tell me one thing though, the cube moves to where it should. Did you press the spacebar to move it around and rotate the model by dragging without clicking? If you did, and the cube still moves to the correct places for the model's bones/lims then at least one thing has been fixed in 4.1