actionscript 3 - inverse kinematic problems -
i have problem inverse kinematic. i'm not able move tentacle , don't know why. implemented many simple skeletons , succeed, in case there must i'm missing. hope can help me!
here have detailed explanation:
1.- image displays tentacle want move. *"flup" movieclip containing both tentacle , circle below. *the tentacle movieclip (inside "flup" said before) *the tentacle owns armature
image
i want create simple motion start so, in case, seek move bluish bone.
2.- flup class, create instance in 1 frame
import illgame.enemy.boss.*; stage.addeventlistener(mouseevent.click,movetentacle); //creation of monster , insertion stage var flup:flup=new flup(); flup.x=300; flup.y=200; stage.addchild(flup); //moves tentacle (in case bluish bone) //to click point function movetentacle(e:mouseevent):void{ flup.movearmature(mousex,mousey); }
3.- flup class, simple @ moment
package illgame.enemy.boss{ import flash.display.movieclip; public class flup extends movieclip{ public function flup(){ } //recives coordinates of click point //"tentacleone" instance name of tentacle public function movearmature(x:number,y:number){ this.tentacleone.moves(x,y); } } }
4.- next, have tentacle class. class father of every single tentacle flup have, it's father of "tentacleone"
package illgame.enemy.boss{ import flash.geom.point; import flash.display.movieclip; import fl.ik.*; public class tentacle extends movieclip{ //variables needed inverse quinematic private var armature:ikarmature; private var bone:ikbone; private var joint:ikjoint; private var point:point; private var movement:ikmover; private var armaturename:string; private var bonesname:string; private var bonesnumber:int; public function tentacle(armaturename:string,bonesname:string,bonesnumber:int){ this.armaturename=armaturename; this.bonesname=bonesname; this.bonesnumber=bonesnumber; armature=ikmanager.getarmaturebyname(armaturename); } //this function supposed move 7ยบ bone (the bluish one) public function moves(x:number,y:number){ bone=armature.getbonebyname(bonesname+"7"); joint=bone.headjoint; movement=new ikmover(joint,joint.position); movement.moveto(new point(x,y)); } } }
5.- finally, tentacleone class, sends info father
package illgame.enemy.boss { public class fluptentacleone extends tentacle{ const num_bones:int=7; public function fluptentacleone(){ super("armature_20","ikbonename",num_bones); } } }
i'm sorry long post, i'm annoyed , have no clue problem is. tries help me.
ps: when run code, x , y vars skeleton position modified visually armature keeps static.
actionscript-3 flash inverse-kinematics
No comments:
Post a Comment