DragonBones improvments

I use DragonBones in my project and some bugs has been fixed by my self :slight_smile:
1 - Armature stops working on the next scene.

2 - Slots draw ordering not applyes his self through animation changing.

  • i fixed, but buggy - need more time.

3 - Meshs does’nt works, but i cant fix this, becuse of Phaser 3 mesh system.

If someone have interes to help me with this, you are Welcome :slight_smile:

Today i created shape tool for DragonBones armatures and debug tool for it.
I want to create online demo, but have no idea on how to share big new version of dragonbones with fixes. So, can’t show demo this moment.

About Meshs, i think about rope, maby it’s can helps to add meshs for armatures!

you only need “out/DragonBones.js”

This version with next scene animation and same name armature seconds scene fixes.
This moment i’m working on Draw ordering animation fix.

I did PR, but it’s seem like noone works on DragonBones this moment :smiley:

Phser 3.50.0-Beta.9 support new Mesh system that can mesh-indices from the box :slight_smile:

Today i fixed one more BUG - Draw ordering trough animation states. Seems to be works, but need more time to test it and sure.

Tested, works :slight_smile:
All fixes are here. You only need DragonBones.js (save it as)

Next step i gonna try to get MESH’s work, but i don’t sure i have so much expirience for that.

4 - “Positive” value for IK bones do not works in animation states.

4 - Positive values and wights in animation states - testing.
I don’t post code, cuse it’s was a litle bit hard, and i don’t sure if it’s works correctli. Need more time to test it in my projects, and then i upload this fix on git and create Pool Request for it.
If you wanna use it on own risk, i post a link on demo later.

5 - Zero FRAME BUG for IK animation Positive states! - testing.
If Armature has it’s own Positive parametr, and in Animation in ZERO frame you have nothing, then app puted “1” whatever you have in Armature. So, if your animation state has nothing in zero frame, it will be Negative before state not changed by next IK FRAME.

Seems to be works…

MESHS have to works with 3.5 beta 9, i need help with this.

6 -Smooth transition in IK weights not works. Don’t sure i can do this.

If you found more bugs, let me know.

dragonBones.js (754.4 KB)

To understand a differents, just do some character with animation, with positive and negative bends in animation, do changes in DRAW ORDERING in animation, and try to compare it with current dragonbones version.


dragonBones.js (754.9 KB)

Today maybe I found a way that allows meshes to be implemented
3.5.0 Beta-9 no wanna run DragonBones plugin or from another side, i don’t sure. I gonna post source code here.

It’s not for normal use, only when you wanna help imprive this plugin work with meshes.

To quickly find the code responsible for the meshes, I left the anchors.
////////////////////////////// MESH PLACEHOLDER FUNCTION
////////////////////////////// MESH PLACEHOLDER
////////////////////////////// MESH DISPLAY
////////////////////////////// MESH DEFORMATION
////////////////////////////// MESH DEFORMATION IN REALTIME

This time i’m stuck on compatibility with 3.5.0 Beta-9. So, need help.

7 - If your IK positive animation state on the momment you change animation has 1, then next animation IK Positive state will be 1 too. hmm…

This is not really a bug, but rather an oversight that should force you to use an IK key for a positive value for every zero frame animation. This can be fixed, but I just don’t see much point in it.

Ok, thx to @kainage answeres on git it’s works with 3.50-Beta9.

Now, i’m stuck on New Mesh Object system from 3.5x.
All i need to do to proofe mesh concept is a crete New Mesh and put indices and verticles to it.

Demo. Click on screen to change animations :smiley:

You can see warns in console - Texture.frame missing:. That’s becuse of old mesh.
////////////////////////////// MESH PLACEHOLDER FUNCTION
LINE 15631 of code

var _this = _super.call(this, scene, x, y, vertices, uv, colors, alphas, texture, frame) || this;

This moment i need help from Richard i think.

Single dragonbones.js file for 3.5.0-Beta9 only
dragonBones.js (754.9 KB)

All you need to run it localy but have to use “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” --allow-file-access-from-files in your chrome browser shortcut.
Phaser3DragonBonesFixMesh.zip (2.1 MB)

Ok, i found in pjaser.js (yea yea, i;m lmao) :smiley:
function Mesh (scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas)

I feel that we are already close!

I try to apply texture and frame to Mesh Object, but setTexture returns error.
Texture.frame missing: [object Object]
Check console output.

Ok i got it. I have to use only names of texture and frame.
No errors now, but still no Meshes on the screen. The Mesh placed on his head.

I’m stack on new Mesh. Have no idea whats wrong…


var SceneMain = new Phaser.Scene('SceneMain');
SceneMain.preload = function(){   
	this.load.atlas('texture', 'texture.png', 'texture.json');

SceneMain.create = function(){ 
	const vertices = [
        -30, 28,
        30, 28,
        -30, -28,
       30, -28
      const uvs = [
        0, 1,
        1, 1,
        0, 0,
        1, 0
     const indices = [ 0, 2, 1, 2, 3, 1 ];
	var mesh = new Phaser.GameObjects.Mesh(this, 400, 400, "texture", "ball", vertices, uvs, indices);

No idea.


var vertices = [-60, 60, -60, 60, -60, -60, 60, -60];
var uvs = [0.54, 0.25, 0.69, 0.25, 0.54, 0.42, 0.69, 0.42]
var indicies = [1, 0, 3, 0, 2, 3]
mesh = this.add.mesh(400, 400, "texture", "ball", vertices, uvs, indicies);


or with no v,u and i.

mesh = this.add.mesh(400, 400, "texture", "ball");


But nothing on the screen.
What’s wrong?

Now i have no time to fix dragonbones only. I will share fixeds files each week.
For last days while testing my version of DB in my game i found, that IK POSITIVE BENDS and IK ZERO FRAME POSITIVE STATE still buggy. I fixed it again, and seems to last time, but no wanna share this with out good testing.

So, last version is here. This version not for 3.50 andhas been tested in 3.20.

dragonBones.js (754.7 KB)

When i become some news about 3.50 beta9 mesh objects, then I will immediately continue trying to run meshes on this plugin.

1 Like

armature.boneWorldPosition - returns bone offset relativly to game space.

					var bone = this.armature.getBone(name);
					var anm = bone.armature.animation.lastAnimationName;					
					var pos={
						var scale=this.scale;
						var flip=false;
						var armatureFlip = this.scaleX;
						function getPos(bone){
							else {
					return pos;

Past it before

ArmatureDisplay.prototype.getBounds = function (output) {

For example. You have cursor coordinates

var pos=SceneMain.input.activePointer.positionToCamera(cam);
var bone=obj.boneWorldPosition("eyes");
var RealBoneXCoordinate = pos.x-bone.x;
var RealBoneYCoordinate = pos.y-bone.y;

Now, you can just apply RealBoneX/YCoordinate to bone.offset.x/y, and your bone will moves to cursor.
Example will be later.

Mesh work is stopped, becuse i cant use texture atlas and frames as a Mesh this moment. I don’t sure do i something right or not

This moment i concintrait my self on my game and become to the Meshes as i become some information about issue.

Hi there.

I had to stop working on the mesh.

Yes, I ran the meshes in the plugin and they show up there. I can even correct them. But I do not know how I could calculate the panZ() parameter. I don’t even understand why it is needed and why without it the mesh does not work like a regular texture. That is, in order to position the mesh on the stage as far as I could figure it out, this parameter is required. Apparently the mesh is part of a 3D scene or some kind of special camera, and this parameter is required for calculations. Anyway, no one helped me figure out how best to use meshes.

For those, who come after me to try do this, In the code, I left a lot of explanations for the parts that are responsible for the meshes.

As you can see the Dragon blinks. It’s mean meshs works.

The problems:
1 - Freezing. Maby mesh.addVertices not so fast as need.
2 - Some meshs flipped, some meshs rendering not right.

So, we need a Richard to fix this, becuse only one who knows, how Meshs works.
I puted anchorns in code:
////////////////////////////// MESH DEFORMATION
/////////////////////////////// MESH DEFORMATION ON UPDATE
Need 3.50 beta10
dragonbones.js (758.4 KB)

1 Like

Hello there :slight_smile:

I haven’t done phaser for a long time, but somehow it was not good to stop halfway :slight_smile: With this thought, I opened the dragonbones source folder and started to think what I missed. I have long had the idea that I missed some sort of clearing the buffer where the renders of the previous frames are stored. And yes, after adding this piece of code, the picture worked smoothly. But still, something more is required. I post edits, who knows, suddenly a couple of thoughts will appear :slight_smile:

As i said before, u just need to start your chrome through --allow-file-access-from-files parameter
like this
“C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” --allow-file-access-from-files to test it
Phaser3DragonBonesFixMesh.zip (4.1 MB)

SO, meshs works, but i think it’s something wrong with indexes calculation! And, one more bug with “SwordsMan” scene. His mesh body and helm on animation #6 each animation cycle does negative scaling. Something like 1 step per cycle. Hmmm :slight_smile:

Functions for editing in folder.zip/api/dragonbones.js
1 - Slot.prototype._updateMesh = function () {
2 - Slot.prototype._updateFrame = function () {
3 - Slot.prototype._updateTransform = function () {
4 - Slot.prototype._identityTransform = function () {
@rich community need your help :slight_smile:

UPD :slight_smile:
Yea yea, we are on the finish line i think!!!

Need to be fixed:
1 - Whend SwordsMan animation #6 is playing - his body going to scaling each new animation cycle! Hmmm, strange :slight_smile:
2 - Mesh not showing ups on last 3x release. Hmm… Strange :slight_smile:
Phaser3DragonBonesFixMesh.zip (4.3 MB)

I found parameter that going to high each cycle. Maby i’m on the way of fix.