Nikos123 Posted April 18, 2017 Share Posted April 18, 2017 In this code here, on the 1st frame of the animation the mesh being animated instantly jumps to the location at the end of the animation, then the next frame it goes back to frame2 at the interpolated location. Any ideas? let unit = selectedUnits[i] // use pythagoras to work out the realtive speed for the units to arrive at roughly the same time let distance = Math.sqrt(Math.pow(pickResult.x - unit.mesh.position.x, 2) + Math.pow(pickResult.z - unit.mesh.position.z, 2)) let framesNeeded = Math.round((distance / common.MEDIUM_SPEED) * common.ANIMATIONS_FPS) // console.log('dist: ' + distance + ' frames' + framesNeeded) let animationBezierTorus = new BABYLON.Animation('animationCore', 'position', common.ANIMATIONS_FPS, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT) let keysBezierTorus = [] keysBezierTorus.push({ frame: 0, value: unit.mesh.position }) keysBezierTorus.push({ frame: framesNeeded, value: unit.mesh.position = formation[i] }) animationBezierTorus.setKeys(keysBezierTorus) unit.mesh.animations.push(animationBezierTorus) this.scene.beginAnimation(unit.mesh, 0, framesNeeded, true) // todo move animation to server side You can see this effect by trying to move any of the blue spheres: http://quantuminformation.github.io/Density-Wars/ Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 20, 2017 Share Posted April 20, 2017 Heya N! Sorry for the slow replies. Is there ANY chance that you could reproduce this issue... in a playground? Or, how about creating a version with no laser and stripped-down core, common, and Game object? Let me make sure I have the symptom correct. Click-on any purple sphere. Then click somewhere on ground grid. There is a "flash-glitch" that happens as animation starts, right? It is ONLY happening on the green box, yes? What does a console dump of green box anim keys LOOK LIKE (dumped just before anim start)? They look correct? Anyway, we have now "bumped" the topic back onto forum page 1. Not easy to troubleshoot... kind of big. Simplify and de-webpack if you can. I'll keep thinkin'. GameMonetize 1 Quote 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.