forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
38
leenkx/Sources/leenkx/logicnode/GetBoneTransformNode.hx
Normal file
38
leenkx/Sources/leenkx/logicnode/GetBoneTransformNode.hx
Normal file
@ -0,0 +1,38 @@
|
||||
package leenkx.logicnode;
|
||||
|
||||
import iron.object.Object;
|
||||
#if lnx_skin
|
||||
import iron.object.BoneAnimation;
|
||||
#end
|
||||
import iron.math.Mat4;
|
||||
|
||||
class GetBoneTransformNode extends LogicNode {
|
||||
|
||||
public function new(tree: LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
|
||||
override function get(from: Int): Mat4 {
|
||||
#if lnx_skin
|
||||
|
||||
var object: Object = inputs[0].get();
|
||||
var boneName: String = inputs[1].get();
|
||||
|
||||
if (object == null) return null;
|
||||
var anim = object.animation != null ? cast(object.animation, BoneAnimation) : null;
|
||||
if (anim == null) anim = object.getBoneAnimation(object.uid);
|
||||
|
||||
// Get bone in armature
|
||||
var bone = anim.getBone(boneName);
|
||||
|
||||
//return anim.getAbsWorldMat(bone);
|
||||
return anim.getAbsMat(bone).clone().multmat(object.transform.world);
|
||||
//return anim.getAbsWorldMat(bone);
|
||||
|
||||
#else
|
||||
return null;
|
||||
|
||||
#end
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user