Notifications
Clear all
[Closed] How can I make per-bone non-uniform scaling code?
Dec 12, 2011 8:34 am
I want to make a character customizing system which is based on max bone scaling. For that, I searched non uniform scaling per bone and find this link.
http://www.gamedev.net/topic/484984-skeletal-animation—non-uniform-scale/
So, I made this code.
fn ResetParentScale obj =
(
local oriTransform = obj.transform; --Get Original Transform of selected object
local oriScaleMatrix = ScaleMatrix oriTransform.scale; --make scale space matrix
local invParentScale = (inverse obj.parent.transform).scale; --make inverse of parentscale
in coordsys oriScaleMatrix Rotate obj oriTransform.rotation; --rotate selected object to its rotation in scale space
local modifiedTransform = obj.transform; --get rotated object transform
PreScale modifiedTransform invParentScale; --applying scale
Rotate modifiedTransform oriTransform.rotation; --rotate back again
obj.transform = modifiedTransform; --set selected object transform
)
ResetParentScale $ --selected object is child of non uniform scaling bone. I want to reset scale of this bone to its original scale.
but as you can guess, it didn’t work. Could you help me to fix this problem?