Search the Community
Showing results for tags 'in place'.
-
My Man... @Deltakosh got another one for your review In Unity for animations that move around (like walk that actual move the skinned mesh forward) they have switch 'Apply Root Motion' when apply root motion is off and they ar using an animation that IS NOT INPLACE they do something to make that skin the bones are on stay 'IN PLACE' ... Does anybody know how I can do something to make my animations stay in place... Maybe at the transform matrix level that I encode into the animation. This is where I 'Sample' the transform compute the matrix to get key for each bone and stack all those on the bone.animation... Maybe I could do something here that 'Keeps' the X,Y AND Z at the original position (like an in place animation)... Or is there some other trick to using NON IN PLACE animations as character movement in BabylonJS ??? Otherwise you will have to go replace ALL the individual animations on a Unity character controller with in place animations for each blend tree node walk, strafe, crouch etc... If you can find IN-PLACE animations to fit your existing Avatar Controller setup. If I can somehow do what unity does (Preferable at the export level when build that bone matrix so I would not have to compensate at runtime or anything like that) and 'DISABLE ROOT MOTION' which keeps a NON-IN-PLACE animation in-place ... Here is how I build the bone.animation for your reference: AnimationMode.BeginSampling(); for (var i = 0; i < clipFrameCount; i++) { clip.SampleAnimation(source, i * frameTime); var local = (transform.parent.localToWorldMatrix.inverse * transform.localToWorldMatrix); float[] matrix = new[] { local[0, 0], local[1, 0], local[2, 0], local[3, 0], local[0, 1], local[1, 1], local[2, 1], local[3, 1], local[0, 2], local[1, 2], local[2, 2], local[3, 2], local[0, 3], local[1, 3], local[2, 3], local[3, 3] }; var key = new BabylonAnimationKey { frame = (i + frameOffest), values = matrix }; keys.Add(key); } AnimationMode.EndSampling(); frameOffest += clipFrameCount; totalFrameCount += clipFrameCount; then dump on the bone: var babylonAnimation = new BabylonAnimation { name = bone.name + "Animation", property = "_matrix", dataType = (int)BabylonAnimation.DataType.Matrix, loopBehavior = (int)BabylonAnimation.LoopBehavior.Cycle, framePerSecond = frameRate, keys = keys.ToArray() }; if (animationState != null) { babylonAnimation.loopBehavior = (int)animationState.loopBehavior; babylonAnimation.enableBlending = animationState.enableBlending; babylonAnimation.blendingSpeed = animationState.blendingSpeed; } bone.animation = babylonAnimation; As always .. any info will help
- 1 reply
-
- animations
- in place
-
(and 1 more)
Tagged with: