Marcousik Posted July 26, 2018 Share Posted July 26, 2018 Hello, I was searching for this but could not find really something, Is it possible to rotate the Head while playing an "classic" animation like out of mixamo ? As for example if NPCs should look /turn head focusing/pointing on the player (or something else) while they are animated with a classic "Stand" animation ? Here there is something with Blendtime and rotation, but not sure if this is for specific Bones rotation... https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_PlayAnimation Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 26, 2018 Share Posted July 26, 2018 I have not ever been successful to get individual bones to manually move while using the "new" PlayAnimation() command, but if you use the older, original command for animation, SetAnimationFrame(), you can rotate individual bones while playing animations. example: window = Window:Create("Example", 0, 0, 800, 600, Window.Titlebar+Window.Center) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:SetPosition(0,.8,-1.8) light = DirectionalLight:Create() light:SetRotation(35,35,0) player = Model:Load("Models/characters/crawler/crawler.mdl") frame = 0 blend = 1 sequence = "Run" Head = player:FindChild("Bip01 Head") Rot = Head:GetRotation(false) while not window:KeyHit(Key.Escape) do if window:Closed() then return false end player:SetAnimationFrame(frame,blend,sequence,true) frame = frame + Time:GetSpeed()/2.5 if window:KeyDown(Key.Left) then Rot.y = Rot.y - 1 end if window:KeyDown(Key.Right) then Rot.y = Rot.y + 1 end if window:KeyDown(Key.Up) then Rot.z = Rot.z - 1 end if window:KeyDown(Key.Down) then Rot.z = Rot.z + 1 end Rot.y = math.max(Rot.y, -45) Rot.y = math.min(Rot.y, 45) Rot.z = math.max(Rot.z, -120) Rot.z = math.min(Rot.z, -40) Head:SetRotation(Rot.x, Rot.y, Rot.z, false) Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawText("Press Arrow Keys to Move Head",2,2) context:DrawText("Rot: "..Rot:ToString(),2,22) context:SetBlendMode(Blend.Solid) context:Sync(true) end 2 1 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Marcousik Posted July 27, 2018 Author Share Posted July 27, 2018 This is genious 100 * thanx ! Question more, should it be possible using the "new" PlayAnimation() command or not ? Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 27, 2018 Share Posted July 27, 2018 As far as I can tell - no. But if you figure it out - please share Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.