Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Trying to animate an object by code using limbs.

Author
Message
mnemonic
19
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden
Posted: 31st Mar 2013 12:35
I'm making several objects to make a character, like a minecraft character, attaching legs, arms and such using 'glue object to limb'
But it seems that I can only glue everything to one 'root' object. Since that object will control, rotation, movement etc. of all the glued objects I can just use that object to move everything, and if I want to move just the leg I can addres it using move object leg, I guess this will work fine.

This is my test code so far:





This gives not a feeling of an object hierarchy, what if I want it? How can I do then, look at the attached picture.

BEST!

www.memblockgames.com
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 31st Mar 2013 12:55
There is a way to attache objects to limbs... add limb or something. I can't remember, but I'm sure the matrix1 plugins have better object limb support. As does enhanced animations and even DKshop(?) I think..

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 31st Mar 2013 13:47 Edited at: 31st Mar 2013 13:48
As Mobiius suggested, you'll be wanting the 'add limb' command. You'll have to use 'make mesh from object' to get the mesh from the object that will be the child limb, delete the object, then add the limb to the parent object. You can also use the 'link limb' command to set up a hierarchy. So you may have the torso object as a start. Then you get a mesh of the upper arm and add it as a limb to the torso object. The you get a mesh of the lower arm and add it as a limb to the torso object as well. At this stage the upper arm and lower arm are not linked. You the link the limbs with the upper arm limb as the parent and lower arm limb as a child.

add limb ObjectId, LimbId, MeshId
link limb ObjectId, ParentLimbId, ChildLimbId
make mesh from object MeshId, ObjectId
offset limb ObjectId, LimbId, X#, Y#, Z#

As a quick example:



Previously TEH_CODERER.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 31st Mar 2013 14:41
Hi there
As Mobiius and Andrew_Neale suggested, you had better add limb instead of glue...add limb link limb and so on. Some time ago I made this animation in a challenge.




Cheers.

I'm not a grumpy grandpa
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 2nd Apr 2013 13:38
I have never needed to use the Add Limb command. It sounds useful in this case.

I have heard that adding lots of game world objects as limbs of the same object can increase rendering performance. Can anyone confirm this?

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 3rd Apr 2013 02:09
Yes that is true...test it yourself...delete remstart/remend to unify all objects as limb




I'm not a grumpy grandpa
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 3rd Apr 2013 06:01
Interesting so it duplicates the object in some form, requiring the original to be deleted?
Does this mean that the objects will share the same texture too?

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 3rd Apr 2013 12:24
Quote: "Does this mean that the objects will share the same texture too"



No... no automatically...we have to make our own function to get limb texture name of all new limbs that we add...

Quote: "for i= 1 to 200
if limb exist(1001,i) then name$= limb texture name(1001,i)
load image name$,i
if limb exist(1000,i+lm) then texture limb 1000,i+lm,i
next i"


It is a bit hard but works...

Cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-07 00:48:54
Your offset time is: 2026-07-07 00:48:54