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.

Geek Culture / The data in a 3d file?

Author
Message
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 23rd May 2004 05:17
I know this sounds strange, but im doing an experiment of applying a sort of bone/joint system in 2d. I need to create a file format containing animation data, but Im unsure how to do it. As its 2d theres no need to record 3 dimensional translation of points (lets imagine that each joint, knees, shoulders etc is a vertex, but not a 3d vertex). Therefore I need only store translation in 2 dimensions, which should at least make life easier.

Any explanations/tutorials/in depth articles/3 page posts welcome

Cheers

Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 23rd May 2004 06:01
Depends on what data you need from the bones; really it is no different from 3D Bones; only you don't have to worry about 3 Floats only 2...

Generally what you need is

Bone Number
Parent Bone Number
Bone End Position (in relation to the parent bone)
Bone Angle (in relation to the parent bone)

Yeah and that's about it really; you have the bone attachments (ie the sprite number or vertices) done seperate, as you usually store the bone data as your Frame 0 ... and then the rest a cut down version where you remove the parent bone/bone numbers and just have the position/angle in a run-length code per animation frame in the bone order.

no need to store the numbers or parent numbers as you've already saved them from the parent bone.

though everyone has thier own way of doing things; i'm sure someone will explain another way.
the biggest plus to programming and also it's greatest downfall is there are so many paths to the same solution.

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 23rd May 2004 06:03
Just come up with your own format syntax and stick to, but expand the syntax as needed.

For example;
You might want to have the syntax something like this:


Then you'd just make up a function to read that info into it's respective arrays etc.

The Radius of effect would be the pixels around the bone that would be effected by the animation.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 23rd May 2004 15:52
Thanks for the help guys, thats helped me a lot. Anyone feel free to add more.

And cheers again

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 23rd May 2004 16:28
Anytime, Shine

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 23rd May 2004 21:49
OK heres one - How do I translate the child limbs etc and rotate them relative to another joint?

Say I had a joint at the pelvis, where the legs meet the stomach, and I rotate it 45 degrees CCW, then all the above points and bones (arms, head, torso et must then be moved and rotated relative to it. Keep in mind that this is being done with proper 2d sprites, DX7, with each body part being a seperate sprite.

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 24th May 2004 12:01
Ok... I had a huge post written up, and it even had beautiful ascii diagrams drawn to go along with it, then I had to answer the phone, and when I got back, my stupid step dad had turned the PC off without saving my work...

But here's the basics of it:

Use NewXValue and NewYValue to work it out...
Let's say that you use the angle as 45 ( as you said ), and that the Pelvis point is at 300,320 and one of the SHoulders is at 250,100...

To work out the new position, it'd be:

NewShoulderX = NewXValue(pelvisX,rotation,DistanceBetweenPoints)
NewShoulderY = NewYValue(pelvisY,rotation,DistanceBetweenPoints)

or;

NewShoulderX = NewXValue(300,45,Sqrt((300 - 250)^2 + (320 - 100)^2))
NewShoulderY = NewXValue(320,45,Sqrt((300 - 250)^2 + (320 - 100)^2))

Have fun.
Jess.

PS I'm not too sure if that distance equation is right


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 24th May 2004 15:11
Cheers

Arkheii
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: QC, Philippines
Posted: 24th May 2004 16:18
Quote: "Keep in mind that this is being done with proper 2d sprites, DX7, with each body part being a seperate sprite."


You're doing this in C?

flibX0r
21
Years of Service
User Offline
Joined: 14th Feb 2003
Location: Western Australia
Posted: 24th May 2004 16:24
could be DBC or old DBPro

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 24th May 2004 16:55 Edited at: 24th May 2004 16:57
Not sure if you want it, but here's a bit of code I made thisafternoon... You inspired me, so I'm going to make the same kinda thing... I bet they both turn out really differently

The code isn't commented very well, but you should get the drift of it

Also, the way it works is, you click once to add the start of a bone, click again to add the end of that bone.

To join bones together when making them ( haven't implimented selecting or draging etc ), hold "j" and click near the end of another bone, and they'll be snapped together. Only opposite ends of bones can be joined though.



Have a Good One
Jess.

[EDIT]
And there may be some un-needed commands or lines in there, cos I tend to put in alot of extra stuff for debug purposes.
[/EDIT]


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
M00NSHiNE
21
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 24th May 2004 19:21
Shame I dont have Pro... maybe I can convert it

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 25th May 2004 03:04
Yeah, if you're using DarkEDIT, you can have global variables in DBC... Just go into the options, and check the "Global Extended Syntax"... And change the Constants to globals too.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 25th May 2004 03:09
Darthster made some 2d rag doll physics in DBP a few months back

Login to post a reply

Server time is: 2024-09-22 00:37:28
Your offset time is: 2024-09-22 00:37:28