Leaderboard


Popular Content

Showing content with the highest reputation on 04/04/2018 in all areas

  1. 2 points
    I understand you so much. Sometimes in the internet I also ask something like "What time is it?" and the response is like "This color is red" But don't worry, some people just don't have a complete solution yet, so they provide at least some ideas/code examples to solve at least some part of your question. Here is my try, I hope complete - https://www.babylonjs-playground.com/#KNE0O#82 I've combined ray and distance calculation. So the idea is to cast a ray from your camera, get picked mesh, calculate the distance between camera and mesh, print results in a console. White dot in the screen center is to help to see camera's direction.
  2. 2 points
    coolroar

    Celestial Sphere Compass

    I like Inteja's Celestial Sphere. It would help one's sense of orientation in a "flying through space" game for example. Here is my Celestial Sphere Compass: https://www.babylonjs-playground.com/index.html#2UFUC3 . I'll use it in an up-coming game to help keep my bearings. All are welcome to use and improve it .
  3. 2 points
    Deltakosh

    Animation Methodology Review

    AnimationGroup.animatables is the way to go. You can reach each animatable and then set animatable.weight and also call animatable.syncWith
  4. 2 points
    jpdev

    egghunt - my Easter bunny jump & run

    Earlier this year, I gave out pieces of paper to friends and children of friends with a jagged outline on them with the instruction to color it in and send it back to me. I received 7 colored shapes. Little did they know, that they were actually coloring Easter eggs for a little game I was making. Now, just in time for Easter it's finished and I thought I would also share it with you guys. Play it here if you like: http://jppresents.net/static/egghunt (see below for instructions) It's written in js using only babylon.js as a library. I did the modelling and levels in blender. I hope you enjoy it, I had fun making it! Thanks to everyone making, maintaining and improving babylon.js Here are the instructions and tips for playing the game: In the main menu start by clicking on a level button. You can only go to levels that you have reached. Start with level one. As long as you hover over a level button, you can see the best time and most eggs collected for the level (only shows your scores & times). (Warning: You can only get a better time if you collect the same amount of eggs or more) cursor left = bunny hops left cursor right = bunny hops right space or cursor up = bunny jumps (press longer to go higher) cursor down = crouch and wiggle your tail tips & tricks: Jumping while crouching results in a high back flip. Jumping three times while maintaining speed results in a high forward flip. Pushing into the direction of a box while falling makes you slide along the box, you can now wall jump.
  5. 1 point
    Hi! Thanks for joining me from my previous thread or if you're new here! Previous thread: MAJOR GOAL: Create a multiplayer game using websockets. GAME CONCEPT: Attempt to be the last ball surviving as other balls and environmental effects attempt to knock you off the platform. STATUS: Finessing the single-player version where it is just player vs. environmental effects. Check out the current incarnation of the single-player game here: http://aaronjanke.com/ballGame/ Github: https://github.com/ballAndBoardInc/ballGame CHALLENGE #1 Currently, I'm looking at finessing the controls. They accelerate too quickly, since holding down the key doesn't provide immediate repetition of the trigger. It's awkward. Looking for smoother acceleration. CHALLENGE #2 We are implementing a game reset, but in its current incarnation it doesnt properly rebind the controls after it resets. Definitely open to thoughts. This is our current control system: scene.actionManager = new BABYLON.ActionManager(scene); scene.actionManager.registerAction( new BABYLON.ExecuteCodeAction( { trigger: BABYLON.ActionManager.OnKeyDownTrigger, parameter: 'a' }, function () { console.log('a pressed'); playerMesh.applyImpulse(new BABYLON.Vector3(10, 0, 0), playerMesh.getAbsolutePosition()); } ) ); scene.actionManager.registerAction( new BABYLON.ExecuteCodeAction( { trigger: BABYLON.ActionManager.OnKeyDownTrigger, parameter: 'w' }, function () { console.log('w pressed'); playerMesh.applyImpulse(new BABYLON.Vector3(0, 0, -10), playerMesh.getAbsolutePosition()); } ) ); scene.actionManager.registerAction( new BABYLON.ExecuteCodeAction( { trigger: BABYLON.ActionManager.OnKeyDownTrigger, parameter: 'd' }, function () { console.log('d pressed'); playerMesh.applyImpulse(new BABYLON.Vector3(-10, 0, 0), playerMesh.getAbsolutePosition()); } ) ); scene.actionManager.registerAction( new BABYLON.ExecuteCodeAction( { trigger: BABYLON.ActionManager.OnKeyDownTrigger, parameter: 's' }, function () { console.log('s pressed'); playerMesh.applyImpulse(new BABYLON.Vector3(0, 0, 10), playerMesh.getAbsolutePosition()); } ) );
  6. 1 point
    NasimiAsl

    Samples for CustomMaterial

    hi i start write some documentation here for custom material ( its realy easy for me to make it here but i can move it in documentation after that complete ) definition : Custom Material inherited from stable version of Standard material (a carbon Copy of BABYLON.StandarMaterial) when we need CustomMaterial ? : any time you wanna make any custom option but you can't manage that in standard material . vertex shader definitions : position(readonly) or positionUpdated(vec3) : local position per vertex normal(readonly) or NormalUpdated(vec3) : local normal fragment shader definitions : vPositionW( readonly) : world position per pixel vNormalW(read only) vDiffuseUV(vec2) : (readonly) : defined uv attribute append when you have DiffuseTexture diffuseColor(vec3) you can manage that with Fragment_Custom_Diffuse : for control Diffuse color **** that mixed with diffuseTexture if you add any texture alpha(float) you can manage that from Fragment_Custom_alpha : for control transparency color(vec4) last result after attached all effect (light fog shadow ... ) you can manage that in Fragment_before_FragColor methods : Start .material = new BABYLON.CustomMaterial("name",scene); Demo : You can define customMaterial exactly like StandardMaterial and you have all property and methods in custom material too AddUniform material.AddUniform('test1','vec3'); simple (float,vec2, vec3,vec4,...) demo sampler without UV with Define UV array array3 , float Fragment_Begin material.Fragment_Begin( string) #include<__decl__defaultFragment> [Fragment_Begin] #extension GL_OES_standard_derivatives : enable for define any new extension or include any shader (not find any requirement for make sample) Fragment_Definitions material.Fragment_Definitions( string) #[Fragment_Definitions] void main(void) { this define before main you can define any varying or global function before main demo : make varying for simple noise used vertex data to add normal demo : change vertex use definition function Fragment_MainBegin void main(void) { vNormalW = vNormalW_helper; #[Fragment_MainBegin] demo : correct normal for back face Fragment_Custom_Diffuse you most find your result red and green and blue (witch any way you like ) and set it in diffuseColor or result *** result (vec3) in this method replaced (one time) by diffuseColor set texture setTexture use diffuseColor Fragment_Custom_Alpha you most find your alpha and set it to alpha variable or in result *** result (vec3) in this method replaced (one time) byalpha demo manage transparency Fragment_Before_FragColor before the last result you have chance to manage your result your final color available in color variable and you most be set it color after your changes *** result (vec4) in this method replaced (one time) by color demo result with and without light effect Vertex_Begin for define any new extension or include any shader (not find any requirement for make sample) Vertex_Definitions this define before main you can define any varying or global function before main Vertex_MainBegin same as Fragment_Main Vertex_Before_PositionUpdated localPosition = positionUpdated; #[Vertex_Before_PositionUpdated] gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0); you most change positionUpdated in here for change last vertex result Vertex_Before_NormalUpdated #ifdef NORMAL #[Vertex_Before_NormalUpdated] localNormal = normalUpdated; vNormalW_helper=normalize(vec3(finalWorld*vec4(normalUpdated,0.0))); you most change normalUpdated in here for change last vertex normal result related samples Update Uniform demo
  7. 1 point
    Add min max pitch to lookAt: https://www.babylonjs-playground.com/#NM5LIX#2
  8. 1 point
    dsman

    Stereo 360 cubemap display

    Ok. Got it. onBeforeCameraRenderObservable will work I think. Will check. And yeah, not anaglyphic but real stereo rendering in split screen (just like vrDeviceOrientationCamera), meant for smartphone VR box.
  9. 1 point
    In fact mesh position was the position of the character who looks in front of him. But you can use the camera instead.
  10. 1 point
    JohnK

    Merging polygons with dynamic textures

    Ciao, lei รจ italiano? Imparo l'italiano ma conosco molto poco Are you trying to do something similar to this? If not please make a picture to show what you want. Note a merged mesh does not merge materials. When you merge meshes the material for the merged mesh is the material of the first mesh. If you want to group the meshes together so that they move as one then use transformNode as a parent
  11. 1 point
    Oh I am sorry, I forgot to call addShadowCaster before the first call of _shouldRender(). Sorry for the noise...
  12. 1 point
    rich

    Path lineTo only creates point in particle?

    Sorry, there was a bug stopping this from working properly. This has been fixed in 3.4, so the above code will do as you'd expect. 3.4 will be released shortly, or can be found in the repo master branch.
  13. 1 point
    lars

    Spine and mesh

    So cool.
  14. 1 point
    Doh, this is what happens when you don't search properly before posting. Now reading https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
  15. 1 point
    Dad72

    Recording Babylon to Video

    Someone already did that with Babylon. Look at this PG http://playground.babylonjs.com/#Z5RY9C#6
  16. 1 point
    Take a look at this playground: http://playground.babylonjs.com/#JA1ND3#73 See the selected/unselected events that fire when someone looks at a flag on the ceiling. You could create something similar using your buttons instead of the flags and when your button is selected/selected add your desired timer logic.
  17. 1 point
    JohnK

    Merging polygons with dynamic textures

    Hi and welcome to the forum. It would be very helpful if you could produce a simple playground to show the problem.
  18. 1 point
    enpu

    Panda 2 now supports Instant Games

    Due to the changes that Facebook made to the Instant Games SDK, the plugin and also the uploading was not working properly anymore. I have now fixed and updated Instant Games plugin to v1.3.1. You should update the plugin to all your games that use Instant Games. https://www.panda2.io/plugins
  19. 1 point
    Hi all, Due to the changes that Facebook made to the Instant Games SDK, the plugin and also the uploading was not working properly anymore. I have now fixed and updated Instant Games plugin to v1.3.1. You should update the plugin to all your games that use Instant Games. https://www.panda2.io/plugins
  20. 1 point
    Thanks for the reply! That document was useful. For anyone else that is new, and is reading this, this is my summary (and please correct me if I am wrong): MetallicRoughness and SpecularGlossiness: are materials for "beginners" to get started into PBR and making simple tests before learning the more complex PBRMaterial. PBRMaterial: is the material to use for production usage, as it combines all the properties of both the MetallicRoughness and SpecularGlosiness, plus adds new properties. This the only material you should be using for production. So basically, we will be using only PBRMaterial for production.
  21. 1 point
    Rodrix3

    What's next?

    I just did! Issue created: https://github.com/BabylonJS/Editor/issues/51 I added the steps for reproduction of bug. About reflection probes, that awesome to hear that!. P.S: This seems to be a nice community. Thanks for all your replies.
  22. 1 point
    Added constellation lines (H A Reys scheme), better star texture and other tweaks. WIP link: Celestial sphere
  23. 1 point
    jonathanlurie

    Texture 3D, is it real?

    YEAH! it works perfectly! Thanks for adding that to the core! For loading the MRI data I use Pixpipe , which is a lib I am developing at the Montreal Neurological Hospital. I will share this example in a git page because I am not too sure how to deal with dependencies and remote data in a PG, and also the MRI has to be loaded in advance and use a callback that only then creates the scene -- I'm not sure we can do that in the playground. I will update this thread when I have a cleaner source to share! But in the meantime, here is a youtube capture of it in action: Cheers!
  24. 1 point
    just sterilize any input before you run it on the server.
  25. 1 point
    JackFalcon

    Animation Methodology Review

    @shen In this case I put a debugger before beginAnimation() and look at the armature and animations. Usually something is wrong with the skeleton on the import... not a problem with the animation (necessarily). Sometimes it is missing too. I did find a singular glTF anomaly in export and using AssetManager. (if i recall correctly). perhaps these are different. Important. With all animations - must prove the concept first. Build animations gradually - exporting every step. see what exported and what didn't (see above) -> because you cannot export everything that you can create in blender... ... then use the blender workflow that is confirmed to export. BabylonJS does famously on the import -> and I switched back to .babylon files. you will probably have to experiment on the Blender side. Good tips above. I was able to do successfully, but it is tricky.