All Activity

This stream auto-updates     

  1. Past hour
  2. How to create score modifier based on overlap?

    Ok so I was able to accomplish what I wanted just by doing this: function laneCScoreModifier (player, lane) { if (player.key == 'heroc') { score++; } else { score--; } } I'm still open to hearing better suggestions or other methods if anyone has any!
  3. Physics Movement

    Looks how nice and neat this class is... This is my equivalent of Unity's Character Controller... To provide basic movement for characters via is API move function... So if you were making a Third person (or any controller for your character) you can move that like like you would in unity (if staying in the spirit of unity design when using the toolkit to make your game)... Anyways the class is fuck sweet... Thanks to all the 'GUYS' work SMOOTHLY and PERFECTLY : And it handle the STATE OF CHARACTER MOVEMENT... Am I Jumping, Falling or Grounded States All built - in... (THAT FRICTION WAS REALLY SCREWING ME UP... BUT FIXED NOW) module BABYLON { export class CharacterController extends BABYLON.MeshComponent { public avatarHeight:number = 2.0; public avatarRadius:number = 0.25; public fallingVelocity:number = 0.1; public isJumping():boolean { return this._jumping; } public isFalling():boolean { return this._falling; } public isGrounded():boolean { return this._grounded; } public getVelocity():BABYLON.Vector3 { return this._velocity; } public getRotation():BABYLON.Vector3 { return this.manager.getAngularVelocity(this.mesh); } public onPhysicsContact:(collider:BABYLON.AbstractMesh, tag:string)=>void = null; private _jumping:boolean = false; private _falling:boolean = false; private _grounded:boolean = true; private _threashold:number = 0.5; private _velocity:BABYLON.Vector3 = BABYLON.Vector3.Zero(); private _angularVelocity:BABYLON.Vector3 = BABYLON.Vector3.Zero(); private _jumpingVelocity:BABYLON.Vector3 = BABYLON.Vector3.Zero(); public constructor(owner: BABYLON.AbstractMesh, scene: BABYLON.Scene, tick: boolean = true, propertyBag: any = {}) { super(owner, scene, tick, propertyBag); this.avatarHeight = this.getProperty("avatarHeight", 2.0); this.avatarRadius = this.getProperty("avatarRadius", 0.25); this.fallingVelocity = this.getProperty("fallingVelocity", 0.1); } protected start():void { this._jumping = false; this._falling = false; this._grounded = true; this.updateGroundingState(); this.onCollisionEvent((collider:BABYLON.AbstractMesh, tag:string) => { if (this.manager.checkCollisionContact(this.mesh, collider, BABYLON.CollisionContact.Bottom, this._threashold) === true) { this._jumping = false; this.updateGroundingState(); } if (this.onPhysicsContact != null) this.onPhysicsContact(collider, tag); }); } protected update() :void { this.updateGroundingState(); } protected after() :void { this.updateGroundingState(); } protected updateGroundingState():void { this._velocity = this.manager.getLinearVelocity(this.mesh); this._falling = (this._jumping === false && this._velocity != null && this._velocity.y < (-this.fallingVelocity)); this._grounded = (this._jumping === false && this._falling === false); } /* Public Character Controller Movement Functions */ public move(velocity:BABYLON.Vector3, rotation:number = 0.0, jump:number = 0.0):void { this.rotate(0.0, rotation, 0.0); this.manager.setLinearVelocity(this.mesh, velocity); if (jump > 0.0) { this._jumping = true; this._jumpingVelocity.copyFromFloats(0.0, jump, 0.0); this.manager.applyImpulse(this.mesh, this._jumpingVelocity, this.mesh.getAbsolutePosition()); this.updateGroundingState(); } } public rotate(x: number, y: number, z: number):void { this._angularVelocity.copyFromFloats(x, y, z); this.manager.setAngularVelocity(this.mesh, this._angularVelocity); } } } SWEET And @fenomas I AM NOT FIGHTING THE PHYSICS ANYMORE... So I am going to bother you in a few days about how to get a little hover at the top of jumps
  4. Game freezes when you click outside of canvas

    Phaser.Stage#disableVisibilityChange
  5. 35-40 images is certainly not a problem for pixi, common pixi optimizations are working for 100-10000 objects. But large images is something universally slow, especially on retina, and you have to actually implement something before I can think of any improvements regarding sizes of your images.
  6. shadow casted by mesh with skeleton not proper

    Yes that would be perfect. Zero influence is "legit" in meshes In my opinion, if I make a flag with a flagpole and weight-paint only the flag to move etc. One more thing when for example the only weight (of only one bone) is low like 0.1 That means only a little infuence. Maybe then the weights sould be 0.1 the minimally influencing bone 0.9 the "identity bone" it can happen with weight paint like my model, so maybe my normalization of weight (if sum is under 1.0) is not correct!
  7. how to access my assets in jsdeliver

    If you make a GitHub repository you can use https://cdn.jsdelivr.net/gh/USERNAME/REPONAME/
  8. Physics Movement

    Yo @fenomas your code sets xdir and zdir and then check in javascript like this: if (xdir || zdir) I would think that check for NON -NULL or in Javascript is it checking for NOT-ZERO ??? I hate the 'loosy goosy' nature of javascript... anything can be anything and anything can change to anything... That is why I love coding with typescript... even though it ends up javascript... but it FEELS like coding in C# or something for the web... actually I used to write Apache Flex Enterprise Application using ActionScript 3 and typescript FEELS ALOT like that Anyways... I think I should be check NOT ZERO
  9. Ok, looks like you may not have an animation which has a start and end being the same. If you do, the start has 1 added to it, see. In this RuntimeAnimation class there is also a gotoFrame() method. I do not use this system, so I do not know how you call this. I do not even remember even see this class before. The playground also errors running 3.0. I also thought playground ran max versions.
  10. I'm currently making my first ever game and am fairly new to coding so I apologize if this code doesn't make much sense. In my game the player sprite changes with the collection of various items. When a certain item is collected I want it so that the score increases when the player is in a certain zone and decreases when the player is out of that zone all while the player sprite is that specific model, and then I want the score to decrease if the player is in that zone while the sprite model isn't correct. (Sorry if that doesn't make sense!) Here is what I have so far: //in the update function: game.physics.arcade.overlap(player, laneC, laneCScoreModifier, null, this); //outside update function: function laneCScoreModifier (player, lane) { if (player.key == 'heroc') { timer = setInterval(plusScore, 1000); if (! game.physics.arcade.overlap(player, laneC)){ clearInterval(timer); } } else { timer = setInterval(minusScore, 1000); if (player.key == 'heroc') { clearInterval(timer); timer = setInterval(plusScore, 1000); if (!game.physics.arcade.overlap(player, laneC)){ clearInterval(timer); } } } } function plusScore(){ score++; } function minusScore(){ score--; } So my first guess is the '!' modifier isn't doing anything there. When I run the game once the player enters the zone while not having the correct sprite the timer never stops, even if they leave. Anyone have any idea how I should approach this? Any help will be greatly appreciated!
  11. Physics Movement

    I just wanna thank EVERYONE for helping me find that shit... Especially @fenomas and @Pryme8 and @Wingnut THANKS DUDES
  12. Physics Movement

    HOLY SHIT... I FOUND THE PROBLEM... WAS SO FUCKING TINY... Started try to port all my code to your playground and then I saw it.... If moving via Zdir or Xdir ... FRICTION = 0 ELSE FRICTION = BASEFRICTION... I tried setting my player (which had a constant friction 0.1) to just ZERO (constant ZERO) and the MUTHER FUCKER (pleas excuse my language) MOVED PERFECTLY.... Such a Small thing like friction = 0.1 while moving fucks you up... I am gonna implement switching from the BaseFriction giving at design time back and forth to ZERO based on whether I am actually moving or not... But I think that it.... That took TWO WHOLE forum post pages to find that shit.... But FUCK... Its FOUND
  13. Here's an excellent example another developer created, which is similar to what I'd like to do. It's using PixiJS (although it's doesn't hit our cross-browser requirements): https://codepen.io/Yakudoo/full/MyMGBX/ The key difference would be that we'd be be using a mix of raster and vector images and additionally including some simple interactive elements based on click/touch events. Any recommendations on optimizing performance when using so many images? One possible direction we could take, design-wise, would be to cycle the raster images in and out (showing around a dozen at a time) while keeping the vector in. Let me know if there's any other specific details you need. Thanks a lot, Ivan.
  14. Today
  15. Cross-browser - yep. Performance for big images on retina is the problem of every rendering lib there, its tied more to html5 and specific devices. Need more details on your case.
  16. Physics Movement

    Yeah @fenomas The Physics Guru
  17. @Wingnut is correct A solution could be to check the pointerup event globally, on the window or document. Example; https://www.babylonjs-playground.com/#GH5SVN#4 Using the mouseout event on the canvas is also possible, but could result in a very interruptive experience for the end-user. imagine panning the camera and the mouse very briefly exits then returns to the canvas without any actual input changes made, mouse inputs are still reset by mouseout event, and the end-user now has to release and re-click his mouse to continue panning.
  18. I'd like to make an interactive, full-window diorama (think "pop-up book") made up of dozens of raster and vector graphics (likely around 25–40). They'd animate on mouse over, unique to their depth and reposition appropriately depending on the device/window-size the app is being viewed on. I attempted this with vanilla JS and quickly hit a limit to the number of images I could use before the framerate dropped (~12 images). PixiJS seems to be a promising option. Would it be able to handle a project like this while also hitting my cross-browser compatibility needs (IE 10 & 11, ever green)? Thanks for the help!
  19. Hi, i have some assets (on dropbox) that i've found on the internet and i want to have them online like what did @samme on jsdeliver this way do you have any idea on how to do it preload: function() { game.load.baseURL = 'https://cdn.jsdelivr.net/gh/samme/phaser-examples-assets@v1.0.0/'; game.load.crossOrigin = 'anonymous'; game.load.image("bar", "sprites/zelda-life.png") }
  20. Realtime rigging

    Thanks @Wingnut I can just try it out to see if its possible. The reason I asked when I did is because I was going into a meeting with this sportswear company that already had clothing created from Marvelous Designer. I anticipated them asking if it was possible to use the existing clothing on top of one of my avatars with minimal manual work required. The meeting is over and they'll be giving me some samples so I can experiment with them. Your idea about the transparent skin texture is the official technique used for clothing within Second Life.
  21. BABYLON.Augmented Reality ... in AR.JS

    Nice, yep. I'll figure out video...
  22. [For Hire] Pixel art animations

    Dude this looks amazing! Hope you find a project soon!
  23. AssetManager & sceneOptimizer contribution

    Hi @Deltakosh I did a PR for the new grading scene optimizer : https://github.com/BabylonJS/Extensions/tree/master/gradingSceneOptimizer I will create the demo when the PR will accepted. I will do a bigger description for the next post with the demo. I have some questions and comments to do . Have a nice day, Pierre. ps : how can I call an extension in a playground ? thanks.
  24. Hi guys! I see this too, Firefox. Not a problem in IE. Step by step, in playground, in Firefox. 1. Depress left mouse button on canvas 2. Still depressed, "drag" left... until arrow is atop editor area 3. Lift mouse button 4. Mouse-over the canvas again (with no buttons depressed). The canvas thinks the button is still depressed (it pans the camera) There is something strange... regarding mouseOut of canvas... while a mouse button is still pressed. It ALSO happens when canvas-dragging onto the top or bottom menu bars, and releasing the drag... atop those. The canvas thinks the mouse button is still pressed, even though it was lifted when pointer was atop the editor/menu areas. I think the effect is called "pointerLock" and it is seen/normal when playground is in full-screen mode. It is not normal when using split-screen mode. It is somewhat annoying for Firefox pilots, but I have always "worked-around it"... re-clicking/releasing over the canvas... to stop the un-clicked camera panning (pointerLock). It has been this way for quite a long time, afaik. It is likely a Firefox bug or anomaly. Possibly, a point of disagreement between browser makers - about Events Specification interpretation, legacy-honoring, or compliance-with new ways. I have no solution... but perhaps I have verified it, and provided a step-by-step way to repro. Again, I see this in FF only, not in IE. Not tested in Opera, Chrome, Safari, Amaya, etc.
  25. Hello everyone, Dot Snap return with new mission: The Battle Gameplay preview on youtube: https://www.youtube.com/watch?v=C4zc0cjBFWg Play the game online now: http://games.odiusfly.com/dotsnapbattle/full Available on google play store: https://play.google.com/store/apps/details?id=com.odiusflystudio.dotsnapbattle More games available on my website: http://odiusfly.com This game is available for licensing.. If you are interested, please contact me via email! ; -) Best regards, Kyriakos
  26. Realtime rigging

    Hi OzR. Sorry for slow replies. I would say it is quite possible... especially if the T-shirt is skin-tight (or real near to it), following exact body contours. Then it can be done by copying SOME positionKind data from the body mesh... into a new blank mesh (or a complete cloning of the rig). But with skin-tight cloth, will "painting" the T-shirt onto the body mesh (modified rig texture)... work just as well? *shrug* A nice hanging, swaying, weighted cloth-like physics T-shirt... is much more challenging, I'd say. Also, the likelihood of getting enough impostor-nodes and joints onto the t-shirt to make it react nicely with your intense animations at decent speeds... is low. So so so many physics joints are needed... for "liquid" cloth sims... that it is an out-of-reach feature with JS, yet, I think. Perhaps your best bet is to deep-clone the rigged skeleton including anims, position them side-by-side, and then up-scale the clone a TINY amount. Now create a texture for the clone that is ONLY the t-shirt. Make the rest of the texture.... transparent. (I bet you wish these texturing steps were automated, eh? *nod*) When everything works right, re-overlay the clone position... atop the master... and animate both rigs, as wanted. The clone rig should animate the same as the master, and thus, the t-shirt should be able to follow all the animations on the master... for they are the same animations. In essence, you're just cloning the rig, and changing the paint job on the clone... to a t-shirt only. As for changing the master rig's texture, or mapping a new "piece" of texture atop the original texture... that might be the BEST idea. No rig cloning needed, but some fancy texture work will be necessary. Just some ideas and comments... likely not good ones. Others will surely comment soon.
  27. I have used code below to find device is mobile or not. var ua = window.navigator.userAgent.toLowerCase(); isMobile = ua.indexOf('mobile') !== -1 || ua.indexOf('android') !== -1;
  1. Load more activity