DylanD

Members
  • Content count

    30
  • Joined

  • Last visited

  1. DylanD

    Animation Curves

    @dbawel Sorry if I wasn't initially clear, I have animation curves in unity that I wish to recreate in babylonjs. I thought that is what you had done. I figured out how to create animations and make those animations follow a bezier curve (or and ease function for that matter), so I think I'm pretty close all I need are the specifics from unity which I should be able to figure that out with some playing around. Thanks for your time.
  2. DylanD

    Animation Curves

    hey @dbawel know anything about making a unity animation curve into a bezierCurveEase? I think thats my best option. Specifically set a start an end point in an animation then making the original curve into a bezierCurveEase then have the animations easing function be that bezel curve. Any ideas?
  3. DylanD

    Animation Curves

    Hey! I figured out my problem, heres how I fixed it! So I wanted to set up an animation in a class constructor that change a quality of the instance of the class(or the class in general I guess). So all I had to do was put the animation on the object "this" instead of sphere. Then reference the variable as just "xVel" so heres the new code. public class player{ public xVel:number; constructor(){ //makes a box up here called var animation = new BABYLON.Animation("Up","rotation.z",60,BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var animationSpeed = new BABYLON.Animation("Speed","xVel",60,BABYLON.Animation.ANIMATIONTYPE_FLOAT); var keys = []; keys.push({frame: 0,value: -Math.PI/12}); keys.push({frame: 5,value:0}); keys.push({frame: 10,value: Math.PI/12}); var keys2 = []; keys2.push({frame: 0,value: 0.1}); keys2.push({frame: 6000,value: 1.0}); animation.setKeys(keys); animationSpeed.setKeys(keys2); this.player.animations = []; this.player.animations.push(animationCopter); this.animation = []; this.animations.push(animationSpeed); } } I still would like to know, if I have two animations on the same object how can I call only one animation to play? Thanks everyone
  4. DylanD

    Animation Curves

    Hey everyone So I figured out the problem, it was when I had var animation = new BABYLON.Animation("Up","rotation.z",60,BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var animationSpeed = new BABYLON.Animation("Speed","this.xVel",60,BABYLON.Animation.ANIMATIONTYPE_FLOAT); var keys = []; keys.push({frame: 0,value: -Math.PI/12}); keys.push({frame: 5,value:0}); keys.push({frame: 10,value: Math.PI/12}); var keys2 = []; keys2.push({frame: 0,value: 0.1}); keys2.push({frame: 6000,value: 1.0}); animation.setKeys(keys); animationSpeed.setKeys(keys2); this.player.animations = []; this.player.animations.push(animationCopter); this.player.animations.push(animationSpeed); on the second line I try to make the animation edit a public class variable, one that is not attached to the player object, so it could not find this.xVel. Figured it out, still have question in my above post about how to use one animation at a time. Is there a way to edit a public class variable if it is not on an object ? So if I have a class public class player{ public xVel:number; constructor{ //some code to set up an animation in this class to affect the xVel public var } how could I fill the constructor such that it can affect the public class variable xVel. Any ideas?
  5. DylanD

    IntersectMesh Trouble

    Hey Sebavan, this did not seem to change anything. Hi again drawl, no I hadn't defined meshes as a constant or any other type of variable(its only ever used in that function parameter). Hey there QuintisHegie, I gave these a try and I have decided making a invisible sphere is my best option. Thanks for the help everyone!
  6. DylanD

    Animation Curves

    Hello again, I was unable to reproduce the problem in the playground as it worked like I had it so it must be something I'm doing wrong somewhere else, I will have to look at this carefully again. I did create a playground here to show what I wanted. So in the playground I have the sphere move along the x and z axis' using animations. https://playground.babylonjs.com/#XQHPV9 Another question though caught my attention how do I use each animation separately? In the playground they are being done at the same time even though I pushed them separately. Dang two games to Sony sounds pretty cool, any I might know of? No I need to import one or make it as close as possible to an existing curve, sorry, would you be able to explain your process for importing them. I was thinking of just using an animation curve with the most points and an easing function but that won't be as exact. Thanks for your time Raanan and dbawel!
  7. Hi again everyone, I have an abstractMesh that is loaded in through the scene loader.importMesh function. So from what I understand I get an array of abstract meshes from this function, which I then use to position the actual mesh and set its properties. I want to save one piece of that mesh (3d model right? yea..) and use it for mesh intersection (my cheap man's collision, which is great btw not trying to belittle it, but it is the easiest collision to use) so I have a public variable in typescript, that is attached to its class lets call it the player class and the variable it the playerBody variable, I was to use that body variable later in a totally different class by calling It through an instance of that class, the same instance I used to import the mesh. However whenever I try to use it with the import mesh it says the variable is underfined. So here a bit of what the code looks like: var importFunc=(meshes:BABYLON.AbstractMesh[])=>{ this.player = meshes[3];//this.player is an abstractMesh public on my class player } BABYLON.SceneLoader.ImportMesh("","./models/","player.babylon",this.scene,function(meshes){ importFunc(meshes); }); so my questions are: 1: Why won't the this.player point to meshes[3]? 2:Even if I do get the abstractMeshes pointed correctly will I be able to use mesh.intersectsMesh() with and abstract mesh and a regular mesh (e.g. a box mesh)? Any ideas? Thanks for your time!
  8. DylanD

    Animation Curves

    Hey again Raanan, I was wondering if you know what this error I get when trying to create a second animation in the same scene as a first animation. So I have an animation already in the scene, and I know works, I have had it working for a while now. Now I need to add a few more so this is what I have setup so far: var animation = new BABYLON.Animation("Up","rotation.z",60,BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var animationSpeed = new BABYLON.Animation("Speed","this.xVel",60,BABYLON.Animation.ANIMATIONTYPE_FLOAT); var keys = []; keys.push({frame: 0,value: -Math.PI/12}); keys.push({frame: 5,value:0}); keys.push({frame: 10,value: Math.PI/12}); var keys2 = []; keys2.push({frame: 0,value: 0.1}); keys2.push({frame: 6000,value: 1.0}); animation.setKeys(keys); animationSpeed.setKeys(keys2); this.player.animations = []; this.player.animations.push(animationCopter); this.player.animations.push(animationSpeed); I get an error that only goes away(as far as I can understand at least) when I comment out the very last line? this error: Uncaught toy-error: cannot read property "getRestPose" of undefined Am I doing something wrong when I add in the second animation? Any ideas? Thank you for your time!
  9. DylanD

    Animation Curves

    Hey Raanan, thanks! I will try these soon!
  10. DylanD

    Animation Curves

    Hi again everybody, I was wondering if anyone knew how to export Unity animation curves into something compatible with Babylon's/typescript. Or something similar to animation curves. I know about making animations and setting them to scenes and what not but I don't understand how exactly that gradually works anyway. I guess my questions are: 1: Is it possible to use a animation curve made in unity in Babylonjs/typescript? 2:Is there something similar to animation curves in Babylonjs/typescript? 3: How exactly does an animation in Babylonjs make things gradual?(below for more on this)? Any ideas? keys.push({frame: 0,value: -Math.PI/12}); keys.push({frame: 5,value:0}); keys.push({frame: 10,value: Math.PI/12}); I have this code for an animation and it gradually goes from -Math.PI/12 to Math.PI/12, but how, linearly or something else? Thanks for your time!
  11. Hey, sorry, I no longer need the web pack build, so I won't be able to work on it unless on my personal time so if I ever get to finish I will let you know how it goes. But yes I did have a bundle.js file in the dist folder if I remember correctly. That probably would have fixed my last issue. Thanks for your time I hope I can get back to you on this.
  12. Yea, VsCode does do that, I guess I just didn't make sense of it. Il definitely try it more. I'm still pretty new to TS so I still have a lot to learn.
  13. Adding the return to the end of my function fixed the problem. Thank you very much! Final Code: var myPositionFunction=(particle, i, s)=>{ particle.rotation.y = Math.random() * 3.5; particle.position.y += 0.1; particle.checkCollisions = true; }; this.SPS = new BABYLON.SolidParticleSystem("sps",this.scene,{updatable:true}); var model = BABYLON.MeshBuilder.CreateBox("m",{width:0.03,height:0.03,depth:0.03}, this.scene); this.SPS.addShape(model,100,{positionFunction: myPositionFunction}); var mesh = this.SPS.buildMesh(); model.dispose(); this.SPS.updateParticle=(particle)=>{ particle.position.x +=this.xVel; return particle; } update=()=>{ this.SPS.setParticles(); }
  14. In this PG the update makes it rotate, I want my update function to be similar, however affect the position. When I copy paste that function into my code, I get an error on this line(79 of the PG), this error: Type '(particle: any) => void' is not assignable to type '(particle: SolidParticle) => SolidParticle'. [TSC] Type 'void' is not assignable to type 'SolidParticle'. The updateParticle in my other example code was not needed or used. So my problem seems to be some kind of typing error because of typescript with the solid particle system update particle function. Heres PG that I made, that shows what I'm trying to do. But when I put that same code into typescript I get an error on line 55(See the above error). Any ideas how I can get around this?
  15. DylanD

    BaseTexture prop uscale not valid

    This worked great, thanks!