Alenvei

Members
  • Content count

    48
  • Joined

  • Last visited

About Alenvei

  • Rank
    Advanced Member
  • Birthday August 27

Contact Methods

  • Twitter
    dayest

Profile Information

  • Gender
    Male

Recent Profile Visitors

547 profile views
  1. Alenvei

    Blender Exporter - Animation for 2 meshes

    Are you tried to call animation by name... like this ? BABYLON.SceneLoader.ImportMesh("", "./", "myAvatar.babylon", this.scene,function (newMeshes, particleSystems, skeletons) { var avatar = newMeshes[0]; avatar.skeleton.beginAnimation("Idle", true, 1); //avatar.skeleton.beginAnimation("Walk", true, 1); //avatar.skeleton.beginAnimation("Run", true, 1); });
  2. Alenvei

    Mesh normal issue!?

    Hi @Swapnil Sorry in advance for bad english . It seem you have issue with backface - culing. I dont know how to 3d max works but try to turn on backface - culing in the 3d - max and if you will get same result ... use the tool with name - Flip normals . I hope It helps you
  3. Alenvei

    Exported file transparency issue.

    so I found other solution : https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered I used .visibility and it works like the .alpha... for now... I leave this issue open yet, because I am not 100% sure.
  4. Alenvei

    Exported file transparency issue.

    No I have other issue myObj is now white.
  5. Alenvei

    Exported file transparency issue.

    no it doesn't works๐Ÿ™ ok it works now I forgot use this code๐Ÿ˜‚ : var mySuperMaterial = new BABYLON.StandardMaterial("haha", scene); myObj.material = mySuperMaterial; myObj.material.alpha = 0;
  6. Hi guys ๐Ÿ˜€ I have one question about exported .babylon file. Is it posibel chagne alpha(transparency) of exported .babylon file? I want to make it slowly disepeat or sotmhig like that. When i change the aplha to 0 nothing happens. BABYLON.SceneLoader.ImportMesh("", "textures", "myObj.babylon", scene, function (newMeshes) { var myObj = newMeshes[0]; myObj.alpha = 0; } So I looked in the exported property whith console.log(myObj). BABYLON.SceneLoader.ImportMesh("", "textures", "myObj.babylon", scene, function (newMeshes) { var myObj = newMeshes[0]; console.log(myObj); } it shows me, that alpha is set NaN. And when I again change the alpha to 0 and looked in the property ... alpha was set 0 but again nothing happens. Why is like that ? Sorry for my bad english. ๐Ÿ˜
  7. Alenvei

    GUI issue with raycast

    Thank you for lesson @Wingnut it works perfectly .
  8. Alenvei

    GUI issue with raycast

    Hello again @Wingnut I found one issue but not with label and raycast. I have issue with animation of doors ... You can see exampel in my last post. When I turn on my "game" everything works fine but after five minutes when I open door the FPS go like crazy and evrey minute it's worse only with door animation. I think the raycast making this trabels but I'm not sure.
  9. Alenvei

    GUI issue with raycast

    Hi @Wingnut ..... this is awesome it works perfectly and I learned new things ...thank you very much Wingnut for me you are pro coder . Guys I made for you playground, which is similar with my game . You can find there two rooms with doors. Go close to the door when label ( with the letter E) shows up then press the E-key on keyboard and see the magic W,A,S,D keys to control the RedBox. Have fun: https://playground.babylonjs.com/#VZRN2V#7 I changed this lines : -Lines 26 -97 : only walls -Lines 163 -194 and 219 : implementation animation for doors ; -Lines 230 : executing animation for doors Have nice day
  10. Alenvei

    GUI issue with raycast

    Hello @Wingnut Thank you for your answer... I very appreciate. I was afraid that I will must use more then one label ๐Ÿ˜•..... ...because in future I would like to make five more doors and more diffrent "labels" (G, F, Q - keys on keyboard) in first level. I am not sure if It will be good for game performance create custom labels for each door What is your opinion guys ?
  11. Alenvei

    GUI issue with raycast

    sorry I forgot for exampel.... here you can try : https://playground.babylonjs.com/#VZRN2V You can see in exampel GUI works with blue Bigbox, but with green Bigbox doesn't works . Why it is so ?
  12. Alenvei

    GUI issue with raycast

    Hello all Sorry for my bad english in advance . I have a littel issue with GUI and I want to understand why it works like taht . What is the issue ? I made this function : function vecToLocal (vector, mesh){ var m = mesh.getWorldMatrix(); var v = BABYLON.Vector3.TransformCoordinates(vector, m); return v; } class Raycast { constructor() { } doorOpener(letHit, myGUI, scene){ this.scene = scene; var origin = player.position; var forward = new BABYLON.Vector3( 0, 0, 1,); forward = vecToLocal(forward, player); var direction = forward.subtract(origin); direction = BABYLON.Vector3.Normalize(direction); var length = 1.5; var ray = new BABYLON.Ray(origin, direction, length); var hit = this.scene.pickWithRay(ray); if (hit.pickedMesh == letHit){ if (control.keys.ePress == 1){ scene.beginAnimation(letHit, 0, 40, false); } return myGUI.isVisible = 1 }else { return myGUI.label.isVisible = 0; } } } This function is responsible to opening doors. When player reach a door then GUI shows up which key(E) on keyboard must be pressed for open the door but the GUI only works whith one door . Here is how I call Raycast function : const view = require('./ray.js'); const panelG= require('./gui.js'); class Leves { constructor(scene,camera,followCam,canvas) { this.scene = scene; GuiP = new panelG.GuiP (scene); doo = new view.Ray (); BABYLON.SceneLoader.ImportMesh("", "textury/mapy/", "lvl01.babylon", this.scene,function (newMeshes) { var level_001 = newMeshes[0]; level_001.checkCollisions = true; var door = newMeshes[1]; door.checkCollisions = true; var door2 = newMeshes[2] door2.checkCollisions = true; var openDoor = new BABYLON.Animation("t", "position.z", 25, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var keys = []; keys.push({ frame: 0, value: 0.45 }); keys.push({ frame:5, value: -1.5 }); keys.push({ frame: 10, value: -3 }); keys.push({ frame: 30, value: -3 }); keys.push({ frame: 35, value: -1.5 }); keys.push({ frame: 40, value: 0.45 }); openDoor.setKeys(keys); door.animations.push(openDoor); door2.animations.push(openDoor); scene.registerBeforeRender(function () { doo.doorOpener (door, GuiP.panel, scene ); /*only animation works*/ doo.doorOpener( door2, GuiP.panel, scene); /* GUI and animation works very good */ }) }) } } I am newbie in babylonjs and javascript too and I want to understand every aspect of babylon js and javascript.
  13. Alenvei

    Raycast - bug or not ?

    Thank you again @Dad72 Yes your second exampel worked for me
  14. Alenvei

    Raycast - bug or not ?

    I understend @Dad72.. so raycast canยดt pick only specific obj ? for exampel : only doors in room with lot of other obj in it
  15. Alenvei

    Raycast - bug or not ?

    @Dad72 I have one question for you I am making littel "Space-RPG" and question is : Can I make 2 imported obj in ma game like for exampel player and door intersect with raycast (raycast is a part of the player ) if i using this mathod : if (rayCast.intersectsMesh(door, true)) { console.log("open"); } else { console.log("closed"); } I have littel problem whit it ๐Ÿ˜• it doesn't register intersection