Jump to content

AlexSor

Members
  • Posts

    1
  • Joined

  • Last visited

AlexSor's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello! I am trying to draw data from this lib using Pixi.js This is part of my code: _.each(pose.object_array, function(object) { var sprite = //link to sprite if (sprite) { sprite.alpha = object.alpha; sprite.rotation = - object.world_space.rotation.rad; sprite.pivot.set(sprite.width * object.pivot.x, sprite.height * (1 - object.pivot.y)); sprite.position.set(object.world_space.position.x, -object.world_space.position.y); sprite.scale.set(object.world_space.scale.x, object.world_space.scale.y); } }, this); Rotation, pivot and scale looks good - like in Spriter interface. But position is wrong and not like in Spriter interface. Why? I placed all sprites in one container and trying to use world_space data. P.S. Using local_space and containers(bones) hierarchy is impossible due to Pixi renderer. It is don't have zIndex and can draw sprites only сonsistently. But Spriter can draw sprite from container1 then from container2 then again from container1 - it is impossible in Pixi. Update: I tried to use local_space and containers(bones) hierarchy, ignoring zIndex. The result almost the same - rotations and scale of sprites identical to Spriter interface, but position is wrong (but little different from previous code) Update: Pixi have a plugin for zIndex, so the hierarchy problem can be fixed. https://github.com/pixijs/pixi-display
×
×
  • Create New...