Posted: 28th Jun 2007 15:26
Is there any way of finding the amount of limbs in an object, then returning the number of each individual limb, i'm having trouble guessing them for my dark physics cars.

I want to return the limb numbers of the wheels on my car that i exported from max but i'm not sure how to find out how these are assigned in max, or how they are recognised in a .x file or how they are recognised in DBPro.

Any help appreciated.
Posted: 28th Jun 2007 15:29
I have written a program for doing it. The interface is a bit user unfriendly/fiddly (keys rather than mouse)because I wasn't planning on releasing it but if you're interested I'll make a download exe.

You can also discover animations in an undocumented model. Which was the first reason i wrote it.

Download Site: http://www.kumkie.com/3dmodelviewer/



You can see that the front wheel is on limb 4, it has no animation frames, and you can get the rotation and scale right etc.
Posted: 28th Jun 2007 15:35
You should name all of your limbs for serious work, then you can search for the limbs by name and not worry about which number they happen to have after you modify them.

You can use the PERFORM CHECKLIST FOR OBJECT LIMBS (iirc) to get a list of the limbs and their names, or you can use one of my utility plug-ins to search for the limb by name.
Posted: 28th Jun 2007 15:36
PERFORM CHECKLIST FOR OBJECT LIMBS(Obj)

Sure that's the one, once you have that assigned to a variable you could make a dummy cube, and position it with each limb and text out the limb number:

Make object cube 10,1
Hide object 10

Function drawlimbs(Obj)
Limbs=Perform checklist for object limbs(Obj)-1

For L=1 to Limbs
Position object 10,limb position x(Obj,L),limb position y(Obj,L),limb position z(Obj,L)
If object in screen(10)=1 then text Object Screen X(10),Object Screen Y(10),str$(L)
Next L

Endfunction


Commands might not be exact, any problems I'll check it tonight when I have access to DBPro and fix it. An app like Gator's is a good idea though, I started a great one that works much like Deep Exploration, it's probably the only DBPro app I ever put on my desktop because I use it so often. Keep meaning to finish it properly.
Posted: 28th Jun 2007 15:57
Cheers people,

After a quick search i also found this

+ Code Snippet
perform checklist for object limbs 2

for X = 1 to checklist quantity()
    text 1,X*15,checklist string$(X)

Next X


Which works just like i want it too, very similar to yours van.

Also, you can't return from the perform checklist for object limbs command and you need to use the checklist quantity() comand.

An app sounds decent, i wouldn't mind having a go at my own, but please, feel free to upload the exe, i wouldn't mind taking a look at it
Posted: 28th Jun 2007 16:18
Also while i'm here, i have my car set up, and it won't play my animation on the car, i tried to simulate the movement of the car due to suspension (because DP doesn't do this through simulation) and its not working, all i am doing is simply;
+ Code Snippet
Function Controlanim()
if rightkey() = 1 then loop object 2,2,2
if leftkey() = 1 then loop object 2,4,4
if upkey() = 1 then loop object 2,8,8
if downkey()=1 then loop object 2,6,6
Endfunction


Any ideas as to why it isn't working, the animation is definately there, does the DP car simulation allow animation to be played as well?
Posted: 28th Jun 2007 16:40
Ok download of exe is ready if you want it go here:

http://www.kumkie.com/3dmodelviewer

are all you animations in the same model file? If its not you need to use append object.
and shouldn't the begin/end frames be different eg.
+ Code Snippet
Function Controlanim()
if rightkey() = 1 then loop object 2,1,2
if leftkey() = 1 then loop object 2,3,4
if upkey() = 1 then loop object 2,7,8
if downkey()=1 then loop object 2,5,6
Endfunction
Posted: 28th Jun 2007 16:43
Whenever the loop object is called, it loops the object from the starting frame to the ending frame and back. You should have a global variable to hold what key was pressed last so you only call that command once, otherwise it will just go back to the first frame every loop.

+ Code Snippet
global lastKey$ as string
lastKey$="none"

function animate( obj )
   if scancode( )=0 then lastKey$="none"

   if downkey( )=1 and lastKey$<>"down"
      loop object obj, 0, 24
      lastKey$="down"
   endif
   if upkey( )=1 and lastKey$<>"up"
      loop object obj, 25, 49
      lastKey$="up"
   endif
   if leftkey( )=1 and lastKey$<>"left"
      loop object obj, 50, 74
      lastKey$="left"
   endif
   if rightkey( )=1 and lastKey$<>"right"
      loop object obj, 75, 100
      lastKey$="right"
   endif
endfunction
Posted: 28th Jun 2007 16:50
I think the problem might be interpolation, like setting the start and end frames as the same means nothing is done, like the model has to move some to erm, well move!

To do that, I'd do this:

Function Controlanim()
if rightkey() = 1 then set object frame 2,2
if leftkey() = 1 then set object frame 2,4
if upkey() = 1 then set object frame 2,8
if downkey()=1 then set object frame 2,6
Endfunction

If you wanted to smooth that out too, like if it's wheels turning left and right for example, you could set the interpolation so that it takes a few moments to set the frame, making a wheel turn smoothly to suit the new frame.
Posted: 28th Jun 2007 17:09
If I wanted to simulate car movement when player presses left I'd tilt/rotate the car body limb to the right. I never use animation for cars. There is a nice tutorial Lee wrote in the magazine somewhere where he gives life the Dark Matter hummer.

good luck with you project.
Posted: 28th Jun 2007 17:17
Actually I'd animate the wheels turning left and right, then you just have to worry about turning them in accordance with the vehicle speed. So maybe you'd have 20 frames, with frame 10 being the wheels straight on, frame 0 with the wheels to the left, and 19 with the wheels to the right - then I'd just set the frame depending on the turn. Thing is that doing it with code just get's fidly, at least with an animated steering you can get them perfect beforehand.

If you try to rotate a wheel left and right and turn it at the same time you run into all sorts of eular issues, pre-animating keeps it simple.
Posted: 28th Jun 2007 17:21
They're limbs though they will stay with the vehicle no matter what speed its going with rotate limb it should be a doddle.
Posted: 28th Jun 2007 17:25
Yeah, but if your turning a wheel then steering it left and right won't work - the wheels would go all wobbly - but if your using animation to steer them, then the wheel turning is kinda seperate from the wheel steering, and therefore you don't get the same wobbly wheels as you would if you just rotated the limb. It's how I ended up having to handle the jeep in OIE.
It's all to do with eular angles, basically you can't rotate a limb on 2 axis at the same time or it goes nuts - that's why I only X rotate the wheels with code, and Y rotate the wheels with animation.
Posted: 28th Jun 2007 17:32
The vehicle is set up with darkphysics, so turning and that is not a problem, i have that all working, its just the fact that there is no visible suspension system on the DP models that i was trying to crudely emulate with animation, i have it working now, ta for the help, it looks crap though :-Y

I wish the DP vehicles had visible suspension, it really takes away from the feel of the car when the WHOLE model just bounces around, rather than just the body of the car, i've tried various methods with the different types of joints and all had erratic results or wouldn't really give the freedom/feel of suspension.
Posted: 29th Jun 2007 15:49
Does anyone knows how to get the size of a limb? And Ian, that would be a very nice addition to your plugin 12, a command like "get limb size x/y/z"