Search the Community

Showing results for tags 'animation'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 586 results

  1. This is how far I got. I want the animation(dragon-attack) to complete when the player hits the dragon and then continue the 'dragon-fly' animation. What would be a solution? function preload() { this.load.spritesheet('dragon', 'assets/demon-idle.png', { frameWidth: 160, frameHeight: 144 }); this.load.spritesheet('dragon-attack', 'assets/demon-attack.png', { frameWidth: 240, frameHeight: 192 }); } function create() { dragon = this.physics.add.sprite(400, 300, 'dragon'); dragon.setBounce(0.4); dragon.setCollideWorldBounds(true); dragon.setDisplaySize(100, 100); this.anims.create({ key: 'dragon-attack', frames: this.anims.generateFrameNumbers('dragon-attack', { start: 0, end: 10 }), frameRate: 10, repeat: -1 }); this.anims.create({ key: 'dragon-fly', frames: this.anims.generateFrameNumbers('dragon', { start: 0, end: 5 }), frameRate: 10, repeat: -1 }); this.physics.add.collider(player, dragon, meetsDragon, null, this); } function meetsDragon(player, dragon) { playerHealth -= 10;'dragon-attack', true); } thanks for your help!
  2. Good day everyone, here is playground attempt: I'm trying to make movement from point1 to point2 by arcus of sphere, and the core goal is to prevent gimbal lock in points of pi/2. Example demonstrates my attemps to make movement from the end of red line to the end of green line though rotating with quaternions around their cross product. The question is: should start quaternion be from target.position.toQuaternion() ? which property should be used in animation object? Thank you for any advices and notes. Theoretically, to rotate object around some axis via Quaternion I should make quaternion with rule (w, v), where w = cos(a/2), and v = n*(sin/a2), where a - is my angle, n - rotation axis, then convert it to the rotation matrix, and use this matrix to prevent gimble lock on the position transform. But in animation it is not working, I do not understand why. I am sure I am doing something wrong with BABYLON API, but I can not find the problem.
  3. Hi! My name is Julia. I’m a 2D Game Artist and Animator. I create 2d characters, objects, UI, backgrounds and flash animations for the games. I use Adobe Photoshop, Illustrator and Flash. I'm interested in full-time freelance, and also individual projects. I prefer fixed rate. Please send me the asset list or detailed description of your project. Then I can tell the full cost and deadlines. You can see my works: You can contact me at
  4. Hi everyone, iam Dante. Pixel artist - 2D animator I have been doing pixel art game for over 6 years Email: My gallery: Skype: wonman321 I love making pixel art game, i really really love it and i can handle many styles (please check my work below) Iam currently available to work on PAID project, both flat rate or hour rate Skill features: Character design Game mockup Animation Special effect Pixel intro / trailer Art direction Music video commission: Bloody Quest project: Amazing fantastics Monsters X Monsters project: Some project i have worked on: Monsters X Monsters: ---- Android: Link Golf Story: (Main animator) (nintendo swich) --- trailer: Girdthyself: (Main artist / animator) ---- Website: Crapface X Elevation - Swim meet: (music video): Story of the End - Revere: (remake design - main animator) --- website: Amazing fantastics: (remake the whole game - main artist) --- website: Contact me if you are interested: Email: thanks for watching.
  5. Hi, If I create animation this way: myanim = scene.add.sprite('myanim'); scene.anims.create({ key: 'myanim', frames: scene.anims.generateFrameNumbers('myanim', { start: 0, end: 20 }), duration: 1000, hideOnComplete: true }); .. and later I want to change it's duration or frameRate - how to do that? I try this, but no luck: myanim.anims.duration = 3000; myanim.anims.frameRate = 15; myanim.anims.currentAnim.duration = 3000; myanim.anims.currentAnim.frameRate = 15; Animation still runs with the initiall duration.
  6. I want to stop the animation but this code doesn't work please help my. var createScene = function () { var scene = new BABYLON.Scene(engine); var camera = new BABYLON.ArcRotateCamera("Camera", 3 * Math.PI / 2, Math.PI / 8, 50, BABYLON.Vector3.Zero(), scene); camera.attachControl(canvas, false); var light = new BABYLON.HemisphericLight("hemi", new BABYLON.Vector3(0, 1, 0), scene); BABYLON.SceneLoader.ImportMesh("a", "scenes/", "ww.babylon", scene, function (newMeshes) { newMeshes[0].position = BABYLON.Vector3.Zero(); newMeshes[0].autoAnimate = false; newMeshes[0].autoAnimateLoop = false; }); return scene;}
  7. I'm trying to apply physics to a animated sprite. I used PhysicsEditor to generate the JSON and loaded the polygon shape for the first frame. Collision detection is not happening when i try to clear the shapes and load the polygon dynamically with respect to animation. Is there any method to clear and load the polygon dynamically to detect collision. Any thoughts ?
  8. I'm new to Phaser 3 and JS in general, so I apologize if I come off super noobish. I'm trying to wrap my head around animations and how to get specific data from an animation (like, frame number, image/frame displayed on pause) I have a sprite sheet that holds all the animations. Each of the six animations is only 2 frames. I have serious limitations in terms of size and how I pack the final "game" (I'm trying to meet facebook's playable ad requirements - a single html file - so I'm using the "assets as data uri" template as a starting point.) Below is how I am handling my animation (I feel as though it's wrong) I searched for examples of how to trigger the next animation when an animation is complete. function createGameObjects () { bg = this.add.image(512, 512, 'bg'); logo = this.add.image(512, 920, 'logo'); popUp = this.add.image(512, 460, 'popUp'); popUp.depth = -1; /* var data = this.cache.json.get('itemsData'); this.anims.fromJSON(data); */ let gearHelm = { key: 'helm', frames: this.anims.generateFrameNumbers('items', { frames: [1, 8, 8, 8, 8, 8, 8 ] }), frameRate: 12, repeat: -1 }; let gearTop = { key: 'top', frames: this.anims.generateFrameNumbers('items', { frames: [7, 11, 7, 7, 7, 7, 7] }), frameRate: 12, repeat: -1 }; let gearPants = { key: 'pants', frames: this.anims.generateFrameNumbers('items', { frames: [ 5, 5, 9, 5, 5, 5, 5] }), frameRate: 12, repeat: -1 }; let gearBoots = { key: 'boots', frames: this.anims.generateFrameNumbers('items', { frames: [0, 0, 0, 4, 0 ,0, 0] }), frameRate: 12, repeat: -1 }; let gearRing = { key: 'ring', frames: this.anims.generateFrameNumbers('items', { frames: [2, 2, 2, 2, 6, 2, 2] }), frameRate: 12, repeat: -1 }; let gearSword = { key: 'sword', frames: this.anims.generateFrameNumbers('items', { frames: [ 10, 10, 10, 10, 10, 3, 10] }), frameRate: 12, repeat: -1 }; this.anims.create(gearHelm); this.anims.create(gearTop); this.anims.create(gearBoots); this.anims.create(gearPants); this.anims.create(gearRing); this.anims.create(gearSword); // timed event to handle animation timedEvent = this.time.addEvent({ delay: 0, callback: onEvent, callbackScope: this, loop: false }); // log anim item console.log(gearSword); } // update function frameUpdateCallback (sprite, animation) { } // on event function onEvent () { this.add.sprite(512, 192, 'items').play('helm'); this.add.sprite(768, 320, 'items').play('top'); this.add.sprite(768, 576, 'items').play('pants'); this.add.sprite(512, 704, 'items').play('boots'); this.add.sprite(256, 576, 'items').play('ring'); this.add.sprite(256, 320, 'items').play('sword'); // pause on click / touch var _anims = this.anims; this.input.on('pointerup', function () { if (_anims.paused) { _anims.resumeAll(); animStopped = false; console.log(animStopped); popUp.depth = -1; bg.setAlpha(1); } else { _anims.pauseAll(); animStopped = true; console.log(animStopped); console.log(_anims.key); popUp.depth = 4; bg.setAlpha(0.5); } }); } I've also attached an animated gif to show what I am trying to achieve. Animation loops and continues until user clicks - then a popup shows. I would like to display the image of the animation frame within the popup box based on where it's paused at. So if I click and stop on item 6 - then display popup with item 6. Again excuse my noobish question which I'm sure is rather easy - I'm trying, and eager to learn. PS - I am coming from Construct :)~ Thanks in advance!
  9. I wanna create a single animation using multiple sprite sheets that I have, which are a kin da content.
  10. Hi everyone, I start learning to use your software because he is really interesting and usefull but I encounter a serious problem with blender export animation. So I create some asset and put them little simple, but when I export the file and put it in babylon, all the animation are compiled in one and apply in all the assets; Let me show you with screen shots. As you can see in the first screen the asset have their own animation but in the 2 and 3 screenshot they have all animation of all the assets Is there a solution about that ? I'll be glad if someone as an answer, thanks you very much and have a nice day.
  11. old_blueyes

    delayed overlap animation

    Hi, Hope somebody can help, I have a sprite which i've coded to animate on overlap. But it's acting very strangely, currently when the sprite overlaps it will trigger the first frame of the animation. Which stays as a still frame, until the sprite finishes the overlap of which then the rest of the animation plays out. It's like there's a delay on the animation somewhere, can't figure out where. If there is, it would be strange as it switches to the first frame of the animation. But it should be one continuous motion. Appreciate it if anyone can take a look: Thanks
  12. Titus

    Walk Animation Shaking

    Hello, I have a player spritesheet with 25 frames for a walk animation loop. When I add the animation and play it without any velocity is works fine. When I add velocity to it I can see that the feet of the sprite are visibly shaking. I've tried playing around with the velocity values and there does seem to be less shakiness with lower velocity values but then the feet are just moonwalking on the floor . I'll add my code below. In the game the velocity is mapped to the right arrow but for testing everything is in the create method here:
  13. Hello everyone! How can I get a camera shake animation to work with ArcFollowCamera? I'd imagine this is useful for situations like a ball (that you're following) hitting a ground or a rocket lift-off sequence. Here's a playground for a cylinder (rocket) doing a liftoff in 1000ms. I can get a "shaking" animation working for the rocket. But when I try to do the same with the camera nothing happens I'm guessing it's because ArcFollowCamera is overriding the camera's position with every frame. Is there a way to do this without resorting to the former? The problem with animating the rocket is it feels off seeing the rocket remain static on the screen while everything else shakes.
  14. In a blender armature modifier there is a setting called "Preserve Volume" which basically stops meshes from collapsing on themselves in some bone-related animations. I'm a newbie animator, but I'm aware that there is more to joints+deformations than just checking the preserve volume box and hoping things look good. This is particularly relevant given that some game engines, such as our beloved BabylonJS (also Unity) do not have this feature. So the question here is really what techniques do people recommend for keeping joints rotating/bending and looking nice in Babylon? An extreme example of volume being preserved versus not preserved occurs when twisting a model comprised of two cubes and two bones. With volume preserved we get what appears to be the twisting of a square column: Without volume preserved, we get twisting that collapses in the vicinity of the joint, creating something like an hourglass: If the twisting motion continues the central joint will get all the way squished: Something similar occurs in other twists such turning a head, in certain shoulder rotations, in internal/external leg rotation at the hip, and probably a bunch of other scenarios. A milder deformation occurs in movements that are mostly single-dimension rotations such as a knee or elbow bend.
  15. How do I play animations created in the blender action editor? I'm trying to organize walk, run, idle, etc animations and start/stop them by name. Also is there a particularly good way to import the blender objects that don't have any world position when the game begins? I noticed there are many different ways to load things. Objects in this game are spawned in after a receiving a network message, so there's no pre-existing concept of a scene (or my brain just isn't used to thinking about scenes). Even the terrain itself is chosen by the server. Which loading strategy should I employ? Blender scene: Action editor from under the dopesheet: Loading and positioning the character (exported with blender/babylon exporter 5.6.4): BABYLON.SceneLoader.LoadAssetContainer("./", "blocky.babylon", this.scene, function (container) { console.log('CONTAINER', container) var meshes = container.meshes var materials = container.materials // manually position the object somewhere that i can see it when the game starts up let whatever = meshes[0] whatever.position.y = 21 whatever.position.z = 4 container.addAllToScene() // can i just get rid of this somehow? // would prefer something like scene.add(new BlockyEntity()), executed later }) When inspecting the loaded `container` object, none of the animations arrays are populated. There does appear to be a `container.skeletons[0]._ranges` that has properties that match the names of my animations (crazy, walk, walkdss, etc). I'm not sure how to play them. Here is the character (appears to be hovering on the last frame of one of one of the animations? or maybe this is just the pose it is in in blender not sure) Thanks
  16. Hey, just started to use Babylon.js, and I am wondering if there is a way to disable or modify the animation on the GUI Button when it is pressed down. Thanks.
  17. Babylonjs has been great so far, but yesterday I ran into an issue that I can't seem to fix. Problem: I'm trying to load in additional animations from .babylon files, however, when playing the animations on the original character it seems the original character's blend pose interferes with the newly loaded animation. The main character is a skinned mesh in a T-Pose without any animations. I then load in the walking animation (code snippet below) Loading the main character: BABYLON.SceneLoader.ImportMesh("", "./assets/models/babylon/", "character.babylon", this._scene, function(meshes, particleSystems, skeletons, animationGroups){ // Init character }); // later BABYLON.SceneLoader.Load("./assets/models/babylon/", "character@walk.babylon", t._engine, function(s) { // Copy all skeletons let children = t._player.getChildMeshes(); for(let i = 0; i < children.length; i++) { if(children[i].skeleton) { children[i].skeleton = s.skeletons[0]; // children[i].updatePoseMatrix(s.skeletons[0].getPoseMatrix()); } } t._scene.beginAnimation(s.skeletons[0], 0, 59, true); }); However, I get this result. The t-pose is blended into the character animations causing this super wide stance; Which would suggest the walking animation transforms are relative? Can I make them absolute? Loading the character@walk.babylon file at the start makes it behave as expected. I simply want to load it in at a later time. Preferably I wouldn't change the skeleton or bones but instead, copy over the animators onto the main rig, but this didn't seem to work either. Any help would be greatly appreciated.
  18. Hello! I'm find the perfect animation example but it works only on one image and in default mode (autoplay on page load). I need to init this only on mouseenter event and for each current image. This is example in codepen I'm found contidion to mouseenter and mouseleave event if ( options.interactionEvent === 'hover' || options.interactionEvent === 'both' ) { slidesContainer.pointerover = function( mouseData ){ mouseX =; mouseY =; displacementFilter.scale, 6, { x: "+=" + Math.sin( mouseX ) * 100 + "", y: "+=" + Math.cos( mouseY ) * 100 + "" }); rotateSpite(); }; slidesContainer.pointerout = function( mouseData ){ displacementFilter.scale, 1, { x: 0, y: 0 }); cancelAnimationFrame( rafID ); }; } The default animation settings is: if ( options.autoPlay === true ) { var ticker = new PIXI.ticker.Ticker(); ticker.autoStart = options.autoPlay; ticker.add(function( delta ) { displacementSprite.x += options.autoPlaySpeed[0] * delta; displacementSprite.y += options.autoPlaySpeed[1]; renderer.render( stage ); }); } I thought I can do something like this if ( options.interactionEvent === 'hover' || options.interactionEvent === 'both' ) { var ticker = new PIXI.ticker.Ticker(); ticker.autoStart = options.autoPlay; ticker.add(function( delta ) { displacementSprite.x += options.autoPlaySpeed[0] * delta; displacementSprite.y += options.autoPlaySpeed[1]; renderer.render( stage ); }); } This is pen with that "changed" part Also I need to load all items, but loads only one item. Why? Thanks
  19. Hunt prehistoric creatures with your friends online. Build your own base, craft tools, and weapons to survive in a large-scale true cross-platform open world game. This game is an application of the engine I’ve built, to prove a statement: It is POSSIBLE to build a 3D version of the Internet, where instead of browsing through websites, we could jump from one 3D space to the next. I “invite” everyone to make this happen. I want you guys to build your own 3D spaces implementing your own ideas what the web should look like in the future. We could just link them all together and make this Interconnected Virtual Space happen - yeah, the Metaverse, for the Snow Crash fans out there Tech Details that I hope provokes further questions: Loading Assets on Demand is even more important in the Browser than on PC or Console. Internet speed is only a fraction of the speed of the hard drive. It is essential to only load whats visible if you want to provide an open world environment for users visiting your world the first time. LOD - Level of Details allows Web Browsers to show something immediately for the users just like an ordinary website. It may look poor and users can see the object improving as they are loaded, still, I think its a good trade-off. Users get a good enough view of their environment instantly and can start interacting with it immediately. Terrain and the Grid System I’ve created the terrain in Blender, then I split it up like a chessboard automatically using Javascript. It is easy/cheap to determine that which cell contains the given coordinate and every single cell in the Grid has a reference to its neighbors. This is the basis of server layers of optimization when it comes to rendering, AI, and collision detection, etc. A recursive search is very easy to do, using those links to neighboring cells. Lighting I've implanted basic Directional and Ambient Lighting to support Day & Night Cycles and Point Lighting for individual light sources like a campfire, torch etc. To my surprise, the difficult part was to get good looking flames, thanks to the lack of Alpha Sorting in WebGL, what I had to implement in Javascript instead. Animation I animate my models in Blender, export them to “.dae". The file format comes with a serious limitation, you can’t define multiple animations and it only maintains a list of keyframes as references. So I maintain a JSON file per “.dae” to define multiple animations by having sets of keyframes. E.g.: “{running: [0, 4], jump: [5,7], ..}”. But I kept it simple and didn’t take it to the realm of animations per body part. Physics In short, I was stupid enough to write my own ..on the other hand, I have a fine level of control over how much I allow it to run. Again, on mobile, it is crucial to have that level of control to navigate 200+ creatures in real-time. I have two different type of Collision Detection. Collision with the Terrain and collision with other model surfaces. Terrain collision is very cheap, this allows me to move so many NPC at once. Collision with other models is heavier though, but that allows me to climb random looking rocks. I optimized it enough to make it feasible to run on mobile devices. I use a low poly version of the models to determine the collision and I only run it for the models near the Player, utilizing the Grid System I mentioned above. AI NPCs can navigate a random terrain, avoid obstacles and “see” and “hear” other NPCs if behind them. At the moment, they move rather robotically, but this allows me to calculate, where they can move next without hitting any obstacles and how long it will take to get there. I only run the AI right before they get to the target location. Basically, 200+ NPCs make only 40-100 AI calls per second. ..I certainly have room for improvement here Multithreading in the browser is difficult but necessary to achieve good Frame Rate. Nothing but the rendering should be on the main thread ideally - Good luck to achieve it though I’ve managed to push most of the heavy logic into a speared thread, but AI is still running on the main one. In a thread you have very limited access to important functionalities of the browser, therefore, there is only so much you can do. Also, specific objects can only be passed by reference between threads, everything else has to be serialized on one end and deserialized on the other. You want to be careful how often you do it. Audio I use the Web Audio API that works as expected. On top of that, I implemented Audio Sprites: I compile all related sounds to a single mp3 file and that comes with a JSON object to define where certain audio snippets can be found. It's a fast, accurate and reliable solution unlike using Audio HTML Tag, but that one has its own use cases as well, e.g.: streaming an mp3 file comes for free, like streaming an internet radio station. Multiplayer - I use WebRTC and not WebSockets - I know, I know, hear me out. The idea was that COOP is a very likely scenario and players may only prefer the company of their friends. I that case, they don’t have to purchase access to a private server, as long as they are happy to let their world go dormant between gaming sessions. Plus, all the logic is implemented for single player mode on the client-side, which logic has to be duplicated on the servers, if I went down the WebSockets rout - just think about where the AI logic should be, server- or client side. I expect this one to be a controversial decision, ..sometimes even I'm not sure whether this was the “right" decision There is a whole lot more to this though. Resources could be distributed between players when it comes to AI to ease the load on the Host - I know it is a potential security issue, but there is a use case for it, like AI for distant NPCs in COOP as long as you have no hacker friends ..this could be crucial on mobile devices. Controller Support The Gamepad API provides you with raw access to every button and joystick. You certainly have to implement your own layer on top of that. Events for pressing/holding down buttons don't come out of the box. Implementation of the dead zone of joysticks is missing and it is inconsistent how you can access different types of controllers through the API, even the same controller but on different devices. In the end, you will have to provide a controller mapping implementation as well in your settings. But its totally doable and works like a charm. Touchscreen Support It's a tricky one. As I mentioned above, on iPhones its completely useless till Apple decides to comply with Web Standards. Even on Android, it is a bit tricky: For the UI you probably want to use HTML. It makes sense because it comes with all the neat features that make our lives easier until you realize that you can’t switch between weapons while running - wait, what? You see, while you are holding down the left side of the screen to maintain speed and try to click on a button, or any HTML element to switch weapons, the click event won’t fire. No click event will be fired while doing multi-touching. As a result, HTML and any fancy framework for that matter are no longer good enough solution own their own. UI When it comes to games we expect a whole lot more from the UI than on a website. Multi-touch support - as discussed above and even controller support is not as straightforward as you might think. You have raw access to the controller, so when a button is selected and the user pushes the joystick diagonally upward, you have no idea what is in that direction, therefore what should be selected next. You have to implement the navigation of your UI with a controller for yourself. And you need controller support because that's the only way to move around in VR and on consoles. Speaking of VR, you want to render your UI twice in VR - once for the right eye and once for the left eye - and only once when not in VR, just something to keep in mind Also, rendering the UI could be heavy. This might be a surprise but if you think about it, on a website you don’t do anything but the UI, so you have a lot mere leeway to work with, whereas in a game you don’t want the UI to impact the Frame Rate, so it has to be very lightweight and probably you want Scheduling to have a final say on what gets refreshed. Taking all this into account, I really don’t see how any framework could be a good option - they were simply designed with different requirements in mind and there is more downside to using any of them than upside. Precomputed Scene Occlusion Culling using a Grid System Most of the optimization is happening real-time or triggered on a regular basis while running the game with one exception: I render every cell in the Grid System from the point of view of every single other Cell. E.g.: Cell A can see cell B and C but not D. I literally diff two images with javascript to determine whether the given cube can be seen or not. Then I record the results in a JSON file, which is used for rendering. This reduces the number of cubes to be rendered significantly, but it takes about 40 hours to run this optimization for the whole terrain. Running the game on Mobile Devices iPhone runs WebGL significantly better than top-end Android devices but practically useless because Apple ignores important web standards. E.g.: Pinch zoom can’t be blocked, therefore when you use your left thumb to move around and right thumb to look around, instead of doing so you end up zooming back and forth the screen. It also doesn't support fullscreen mode - video does, but not the canvas element. Another interesting limitation on iPhone is that you can only have 25 elements in an array in GLSL, which translates to having only 25 bones in an animated model. This doesn't make animation impossible, but you can’t use most animated models that you buy in the stores, you have to do it again with only 25 bones. Profiling “What gets measured, gets managed”. The built-in profiler in Chrome certainly has its use-case, but not good enough for what we want, so probably you will have to build your own at some point with specific features. You want to know how long a certain section of your game runs per frame, e.g.: Rendering, AI, Physics, etc. and probably these sections won’t run sequentially, but they are interrupted by other processes that you don’t want to include into the specific measurement. One thing is for sure, you cant do optimization without identifying the source of the lags. - I've certainly wasted enough time trying Scheduling As long as you are pushing the limits of the devices it is always a battle for a smooth frame rate. Therefore, you have to implement a scheduling system to manage what is allowed to run and for how long. E.g.: whatever is loaded and processed in the background will have an effect on the frame rate even if it is running on a different thread, you want to throttle that. You don’t want to set variables through WebGL API unnecessarily. AI always varies how much calculations it has to do depending on the number of unique encounters of 200+ NPCs in a random environment. Basically, you will have to limit what runs and how long, manage what is a nice to have calculation and a game-breaking one and try to make it seamless for the user. Probably every single topic above deserves a dedicated post, so please feel free to ask anything - there is no stupid question - then I would like to use those questions to write an in-depth post on every single topic that helps fellow devs to overcome similar obstacles - no doubt I will learn a thing or two in the process Live Tech Demo is available on
  20. I'm a bit lost and confused about PlayAnimationAction. Here's a PG. Click on the cube to play animations. There doesn't seem to be a way to target only one of the defined animations - it always plays both. I would have expected there'd be a way to specify which animations (by name) should be played when this action is triggered. Am I missing a trick here?
  21. I've downloaded an fbx model from Mixamo, imported the fbx into blender and then exported to .babylon. When I load the model and begin a bone animation, the model distorts. Could someone tell me what I'm doing wrong? BABYLON.SceneLoader.ImportMesh("Akai", "scenes/", "skintest.babylon", this.scene, function (newMeshes, particleSystems, skeletons) { newMeshes.forEach(s=> s.material = mat2); newMeshes[0].rotation.x = -Math.PI / 2; newMeshes[0].scaling.x = .2; newMeshes[0].scaling.y = .2; newMeshes[0].scaling.z = .2; newMeshes[0].position.y = -20; that.scene.beginAnimation(newMeshes[0].skeleton, 0, 10, false, .1); }); skintest.log.txt
  22. Alright errybody This is a question more about maths than anything else, and i'm terrible at maths so I'm hoping someone (maybe @Wingnut) can help me here. My scene is loaded from a blender export, which in itself is partially an imported FBX from C4D (still waiting on that C4D exporter boys!). I have a mesh within the scene that has a set position, and I want to allow it to orbit in a circle when clicked or tapped by the user. Fundamentally this is fine and I have most of the logic in place, but I'm struggling to figure out how to make it animate from it's initial position. All of the example code I've seen make the object jump to a calculated first position and then animate, which is not what I want. Has anyone got some sweet ninja code that I can borrow steal that will do what I need? Additionally is there a convenient technique or built in method to add easing to the beginAnimation call, or to the calculated keyframes? Cheers! Here's my current code: var onMeshPicked = function(bjsEvent) { myPickedMesh = bjsEvent.source; var frames = 90; // number of points var parent = myPickedMesh.parent; parent.indexPoint = 0; var p=0; var points = []; var radius = 2; for (var i = 0; i < frames; i++) { // calculate the keyframes points.push( new BABYLON.Vector3((radius + Math.sin(i*Math.PI/frames))* Math.cos(2*i*Math.PI/frames), parent.position.y, ( radius + Math.sin(i*Math.PI/frames)) * Math.sin(2*i*Math.PI/frames))); } parent.points=points; var path3d = new BABYLON.Path3D(points); var tangents = path3d.getTangents(); //array of tangents to the curve var normals = path3d.getNormals(); //array of normals to the curve var binormals = path3d.getBinormals(); //array of binormals to curve parent.animationPosition = new BABYLON.Animation("animPos", "position", 30, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); parent.animationRotation = new BABYLON.Animation("animRot", "rotationQuaternion", 30, BABYLON.Animation.ANIMATIONTYPE_QUATERNION, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var keysPosition = []; var keysRotation = []; for(i = 0,p=frames; i < p; i++) { keysPosition.push({ frame: i, value: parent.points[i] }); keysRotation.push({ frame: i, value: BABYLON.Quaternion.RotationQuaternionFromAxis(normals[i], binormals[i], tangents[i]) }); } parent.animationPosition.setKeys(keysPosition); parent.animationRotation.setKeys(keysRotation); scene.beginDirectAnimation(parent, [parent.animationPosition,parent.animationRotation], 0, frames, false, 0.25,null); };
  23. Hi, I hope that I find you well, I am a little stuck. I have a group of sprites, that on overlap of another jump sprite image, I require it to play the jump animation, but only on the individual sprite within the group, when it has overlapped. My code, is pretty much working how I want apart from this issue, in the current build, on overlap the animation will play for all sprites within the group (not an individual basis), and will trigger again (beyond the original, overlap) if another sprite hits the jump image. Appreciate any assistance. var game; var globalParams = { calculatedWidth: 1350, calculatedHeight: 900 } var GameResolution = { _1350: 1350, _960: 960 }; function calculateSize() { // Get Pixel Width and Height of the available space var w_w = window.innerWidth * window.devicePixelRatio; var w_h = window.innerHeight * window.devicePixelRatio; var g_w = w_w; // We prepared all assets according to aspect ratio of 1.5 // Since we are going to use different assets for different resolutions, we are not looking at the resolution here var originalAspectRatio = 1.5; // Get the actual device aspect ratio var currentAspectRatio = g_w / w_h; if (currentAspectRatio > originalAspectRatio) { // If actual aspect ratio is greater than the game aspect ratio, then we have horizontal padding // In order to get the correct resolution of the asset we need to look at the height here // We planned for 1350x900 and 960x640 so if height is greater than 640 we pick higher resolution else lower resolution if(w_h > 640){ globalParams.selectedResolution = GameResolution._1350; globalParams.calculatedHeight = 900; globalParams.calculatedWidth = w_w * (900 / w_h); } else { globalParams.selectedResolution = GameResolution._960; globalParams.calculatedHeight = 640; globalParams.calculatedWidth = w_w * (640 / w_h); } } else { // If actual aspect ratio is less than the game aspect ratio, then we have vertical padding // In order to get the correct resolution of the asset we need to look at the width here if(w_w > 960){ globalParams.selectedResolution = GameResolution._1350; globalParams.calculatedWidth = 1350; globalParams.calculatedHeight = w_h * (1350 / w_w); } else { globalParams.selectedResolution = GameResolution._960; globalParams.calculatedWidth = 960; globalParams.calculatedHeight = w_h * (960 / w_w); } } } window.onload = function () { calculateSize(); game = new Phaser.Game(globalParams.calculatedWidth, globalParams.calculatedHeight, Phaser.AUTO, 'gameDiv'); game.state.add('main', mainState); game.state.start('main'); //game.forceSingleUpdate = true; } var yourGroup; var mainState = { preload: function() { if(!game.device.desktop) { game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.setMinMax(game.width/2, game.height/2, game.width, game.height); } game.scale.pageAlignHorizontally = true; game.scale.pageAlignVertically = true; // Background game.stage.backgroundColor = '#71c5cf'; // Horse Sprites for (var i = 1; i <= 3; i++) { this.load.spritesheet('runner'+i, 'assets/horse-'+i+'.png', 368, 300); } // Other Sprites game.load.image('fence', 'assets/jumpfence1.png'); game.load.image('track', 'assets/grasstrack1.png'); }, create: function() { this.jumpGroup =; this.timer =, this.addNewJump, this); this.horseGroup =; this.horseGroup.enableBody = true; this.horseGroup.physicsBodyType = Phaser.Physics.ARCADE; this.addHorse(this); }, addHorse: function() { for (var i = 1; i <= 3; i++) { var posY = game.rnd.integerInRange(300, 500); var posX = game.rnd.integerInRange(30, 120); geegee = this.horseGroup.create(posX, posY, 'runner'+i); // Add 'sprite' to the group this.horseGroup.sort('y', Phaser.Group.SORT_ASCENDING); geegee.animations.add('gallop', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 20, true); geegee.animations.add('jump', [4, 11, 12, 13, 14, 15, 16, 17, 4], 14, false); } }, addJump: function(x, y) { var fence = game.add.sprite(x, y, 'fence'); this.jumpGroup.add(fence); game.physics.arcade.enable(fence); fence.body.setSize(50, 350, 105, 0); fence.body.velocity.x = -500; fence.checkWorldBounds = true; fence.outOfBoundsKill = true; }, addNewJump: function() { this.addJump( - 40, -'fence').height); }, update: function() { this.horseGroup.forEach(function(item) { // jump fences, this.jumpGroup, this.fenceJump, null, this); this.hurdle(); // move up and down field if (item.x > game.width - 650) { item.x = game.width - 650; item.body.velocity.x += game.rnd.integerInRange(-5, 0); } else { item.body.velocity.x += game.rnd.integerInRange(-5, 5); } if (item.x < 50) { item.x = 50; item.body.velocity.x = 0; } }.bind(this)); }, fenceJump: function(horseGroup,jumpGroup) { this.horseGroup.forEach(function(item) { item.body.velocity.y = 1; hurdleFence=false; }.bind(this)); }, hurdle: function() { this.horseGroup.forEach(function(item) { if(!this.hurdleFence){ //check if we already have -50 gravity or not if(item.body.velocity.y > 0){, this); function airJump() { item.body.velocity.x = 5; item.body.gravity.x = 100; }'jump');, this); function groundGallop() { item.body.velocity.y = 0; } } else {'gallop'); } } }.bind(this)); }, };
  24. Can I play the animation starting from random frame, and then loop? Say I have 20 frames. I want to start from 8th, continuing to 20, and then loop from 1st all the way to 20th and so on. This doesn't seem to do anything: animations.frame = 8;"all");
  25. Hi everyone! I have a personal project that I need help with - mostly [basic] modeling and animation. I don't have any funding apart from my own paycheck, but I'm happy to pay, and spread the project out across paycheques as required. What I need (most important to least important): 1) A 3D shape to present two lines of text (one small and one large) and a circular logo I'm planning to use the GUI system to draw the text on a transparent plane just in front of the surfaces of the object I need to be able to change logo and text on the fly, and then animate the entire thing as a single object (rotation/flip and slide) Think of it like one of the boxes that slides from the bottom left corner of a news report or documentary with the name of the person being interviewed Materials, 3d shaping, texture, bump-mapping etc to add visual appeal, but I'm no artist A vague concept has been attached to this post 2) An animated asset to convey information about a playing song I'm most partial to the idea of a spinning record that I can put text on the label of, with a needle on the side A spinning CD would work An animated VU meter or spectrum peak graph would also work It will also need some kind of surface to place artist/track name on 3) A basic representation of a person Cone body, sphere head and disconnected sphere hands is absolutely fine I need to be able to change the colour of the body/shirt/whatever on the fly I need basic animations with: (1) waving a 'hand' in the air; (2) waving both 'hands' in the air; (3) clapping 'hands' above 'head'; (4) jumping and waving an oversized #1 foam hand in the air; and (5) bouncing (running gait) while waving 2 oversized foam hands in the air, possibly wearing a beer-bong hat. Assets will be presented on a flat (ortho, 90 degree) autonomous (non-interactive) stage, but will be spun, flipped and rotated, in addition to the required built-in animations. I will sort out the code side of things for the most part. PM me if you're interested.