Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How Spine works with corona?
Started by LairdGames Feb 17 2013 04:11 PM

31 replies to this topic
[TOPIC CONTROLS]
Page 2 of 2 1 2
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 974 posts
  • Corona SDK

Thx for your answers. I have one other questions: Is it possible to create (for example) a character with bodyparts, animate it (rotate the hands and legs, head and so on) and then take this animation and do other transformations on the whole animating character, like for example a rotation, while the hands and bodyparts are still moving... or other transformations on the whole character?

 

Thx for your help!

 

Daniela



[TOPIC: post.html]
#27

Reaver

[GLOBAL: userInfoPane.html]
Reaver
  • Enthusiast

  • 87 posts
  • Corona SDK

I haven't done this but I think the way to do it is something like:

animation.apply(skeleton, delta)
-- Do rotations and move limbs.

skeleton:updateWorldTransform()

By changing the skeleton between the animation call and the updateWorldTransform call you can make individual bones behave independently of the animation without effecting the rest of the animation.



[TOPIC: post.html]
#28

matias9

[GLOBAL: userInfoPane.html]
matias9
  • Observer

  • 18 posts
  • Corona SDK

Yes, it sure is. When you create a new Spine character in Corona, it will either create it's own displaygroup (skeleton.group) that you can then scale and transform freely. You can also pass in your own displaygroup if you want (in skeleton.new, see spine.lua), wherein the spine object will be created.

Basically, what you'd do is:

skeleton = spine.Skeleton.new(skeletonData)
skeleton.group.rotation = 125

[TOPIC: post.html]
#29

matias9

[GLOBAL: userInfoPane.html]
matias9
  • Observer

  • 18 posts
  • Corona SDK

I haven't done this but I think the way to do it is something like:

animation.apply(skeleton, delta)
-- Do rotations and move limbs.

skeleton:updateWorldTransform()

By changing the skeleton between the animation call and the updateWorldTransform call you can make individual bones behave independently of the animation without effecting the rest of the animation.

 

Looking at updateworldtransform code (spine.lua around line 112), it certainly doesnt seem like you can. animation.apply sets the correct values for all the bones and updateworldtransform sets the displayobjects values to match those, overriding anything that already was there.



[TOPIC: post.html]
#30

Reaver

[GLOBAL: userInfoPane.html]
Reaver
  • Enthusiast

  • 87 posts
  • Corona SDK

Looking at updateworldtransform code (spine.lua around line 112), it certainly doesnt seem like you can. animation.apply sets the correct values for all the bones and updateworldtransform sets the displayobjects values to match those, overriding anything that already was there.

 

I think I misunderstood the question. I thought it was about rotating limbs of the skeleton to some new position like following a touch event while still animating.

 

If you call animation.apply then change the skeleton, updateWorldTransform() sets the display objects values to the overridden skeletons values.



[TOPIC: post.html]
#31

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 974 posts
  • Corona SDK

Thx again!

 

One more question: Is it possible to change graphics inside the animation? In the editor we have the two sections "setup" and "animate". In "setup" we can change the graphics... for example "eyes_open" to "eyes_closed". In "animate"  we can't do this changes and we can't use keyframes for setting new graphics, like "eyes_closed".

 

Is it possible to somehow make the characters eyes blink while walking?

 

Daniela



[TOPIC: post.html]
#32

ojnab

[GLOBAL: userInfoPane.html]
ojnab
  • Contributor

  • 615 posts
  • Corona SDK

Sure, set a timeline position then change the visible image in the tree for a slot. A yellow dot will appear in the key column for the slot, indicating an un-keyed change has been made. Click the dot and it will change to red to indicate a key has been set.




[topic_controls]
Page 2 of 2 1 2
 
[/topic_controls]