Babylon3D: Standard Edition

  • matriax The camera cannot have a parent, I forgot to remove that function.

    MATAGUIRIS You should use the scene loader plugins, export your scene from Blender, 3DS Max or Unity 5 and load it inside C2

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • X3M Ah ok!

    I fixed the camera problem with this expresion to convert radians in degress in case somebody needs too:

    (change the "cam_pos" for the sprite you are using for the camera or whatever)

    So now i can set a sprite with any rotation in the C2 layout and the camera will appear exactly like that.

    I don't know if is possible but for the next update to fix minor things, can be added a camera rotation using degrees 0-360? I not mean change radians for Degress, maybe another action exactly like now adding that conversion and renaming as "Rotate by Radians" and "Rotate by Degress". This will also avoid people get crazy to understand how the camera rotation works.

    If not at least in the action description add some info like "Babylon Rotation uses Radians | 6.28 = 360º" to be clear.

  • matriax I did it for the meshes and I forgot to do it for the cameras , here if you take a look at the function :

    	Acts.prototype.RotateMeshBy = function (x, y, z) {
    		var mesh = this.runtime.scenes[this.properties[1]].getMeshByName("mesh" + this.uid);
    		mesh.rotation.x += cr.to_radians(x);
    		mesh.rotation.y += cr.to_radians(y);
    		mesh.rotation.z += cr.to_radians(z);
    	};
    [/code:3jgk9dvj]
    But for the camera it's : 
    [code:3jgk9dvj]
    	Acts.prototype.RotateCameraBy = function (x, y, z) {
    		var camera = this.runtime.scenes[this.properties[1]].getCameraByName(this.properties[0]);
    		camera.rotation = new BABYLON.Vector3(camera.rotation.x + x, camera.rotation.y + y, camera.rotation.z + z);
    	};
    [/code:3jgk9dvj]
    
    You can temporally fix it by changing it to :
    [code:3jgk9dvj]
    	Acts.prototype.RotateCameraBy = function (x, y, z) {
    		var camera = this.runtime.scenes[this.properties[1]].getCameraByName(this.properties[0]);
    		camera.rotation = new BABYLON.Vector3(camera.rotation.x + cr.to_radians(x), camera.rotation.y + cr.to_radians(y), camera.rotation.z + cr.to_radians(z));
    	};
    [/code:3jgk9dvj]
    
    It's line [b]481 [/b]inside the [b]babylonNewCamera/runtime.js[/b]
    
    Again sorry for these small overlooked mistakes, I've been quite busy lately with some life stuff, and I still need to finish some other projects that I've been working on. 
    I will revise the codes as soon as possible, they are not huge problems, just small mistakes.
  • X3M Ah i see! no problem as you said all are just minor things.

    I changed it but not worked correctly, no sets the exact rotation, just by some decimates. I add 90, 180,etc... but not looks correct, with the previous conversion worked perfect.

    I set 90 degress, but in the render i used the debug and to be correct have to be set at 89.5 . So maybe there is an error in that conversion code?

    BTW, i will back to the previous expresion with a note that have to be changed for the next babylon update.

  • X3M I'm with the stairs/ramp problem again.

    The unique solution is use a bigger scene scale? For the actual scene i'm using a camera ellipsoid of 8,10,8 but some stairs still do some "eartquake" effect when try to go over them and the ramp push me to down.

    Only when the ellipsoid Y is over 50 the ramp stops to push me down,etc... that i guess is how i solved the last time, in blender export or select all and scale all the scene much bigger.

    I tried to set the ellipsoid collision of some objects to 0 but still not works or maybe that funcion is deprecated i don't know.

    So i guess i will have to export the cube again in a x5 scale or do it 5 time bigger to set the elipsoid Y on 50. In your FPS example the camera ellipsoid is "1,30,1" so i guess this is the way to do it.

  • matriax Can you send me the capx please ?

  • Why the gravity is constant? I mean i set -9.8 in various sites and in all the same effect, you fall constantly at 9.81 speed or whatever, when in theory you have to fall every time more faster.

    In theory is -9.8 every second(or m/s o something like that), but in the moment there is nothing under your feets the -9.81 is applied, instead of start with 0 and increase 9.8 each second. (I'm talking of memory).

    How can i achieve that? In camera only appear "apply gravity" and in physics like oimo,etc... i set -9.8 with the same result as "scene native gravity",etc... ¿?

    And I guess this also can improve the climb stairs/ramp actions and avoid the "earthquake" effect because instead of 0 or 9.8 gravity will apply 0 and increasing from 0 to whatever.

  • matriax The camera uses a native physics engine, it does not use Oimo or Cannon. The native engine doesn't mimic real life physics at 100%.

  • matriax The camera uses a native physics engine, it does not use Oimo or Cannon. The native engine doesn't mimic real life physics at 100%.

    Then how i make the gravity of the camera real? MMm maybe some event with a local variable that if camera is not colliding with nothing adds 0.1 of gravity each 0.1 seconds and when collide to something set to 0 ?

    Or maybe there is an expresion that can be added to the Y gravity like "(-9.81*Seconds)/Variable" to fake it?

    Any ideas?

    Edit: Well i already fake it the falling gravity. But now i need some check when the camera is not colliding with nothing. Mmm

  • Ohhh i think i fake it the Camera real gravity .

    Still a bit dirty but is working. I'm going to test it all better....

  • matriax Glad you got it working, are you making a minecraft like game ?

  • X3M Not really, first the idea is do some kind of template/Engine for FPS, with all the basic parameters added and all working with camera, fog, gravity,etc.. to be easy to use.

    After that will see, but yes for a first try some lowpoly/res game in 8bits with C2 shaders i think can look really cool. Something like Cube Rampage on all are basic shapes but with effects and other techniques give it a cool touch. For that the thing about deactivate anisoptric filtering, nearest instead of bilinear sampling mode,etc... to have sharp pixels.

  • Trying to achieve another thing that i though was more easy...

    If you aim the sky and go forward(W) you can fly or go up, in the same way if you look at the floor and go backwards(S) you can fly or go up.

    I tried to do some fixes but nothing worked. I simply want that when i press W to go forward the camera moves forward over the floor without matter if is aiming the sky. And if i look the floor and press S i want to go backwars no UP.

    I guess maybe the set controls to camera is not what i need here, so i tried with "set position", "translate by" and "translate by ease" but can't get it to move correctly. The one that detect colisions is the "translate by ease", but i can't figure how to set that when i press the key goes to the direction in front the camera not the world axis. I tried the FrontCamera expresions and others like Camera.DirectionX but always is a mess. Also tried that when i press W fix the y position to avoid flying but nothing working 100% fine.

    Is there any solution for this X3M ? I willleave at the moment, I'm going to test other things like jump, crouch,etc....

  • The camera is meant to be moving freely if you don't activate physics, hence the name Freecamera. These are things that are normal and that were made by the BabylonJS devs.

    A Freecamera goes forward when you press W and backwards if you press S, it takes under consideration the rotation of the player.

    So if you wanna make your own settings, then I recommend you change to Targetcamera instead of Freecamera, that way the camera behavior won't interfere with your settings and controls.

    On keypress W:

    Set camera position to (Camera.FrontXPos(1),Camera.FrontYPos(1),Camera.FrontZPos(1))

    On keypress S:

    Set camera position to (Camera.FrontXPos(-1),Camera.FrontYPos(-1),Camera.FrontZPos(-1))

  • I can't set a TargetCamera when i do get this error:

    I tried to set the targetCamera in your FPS to see if was my code and the same error .

    BTW, i tried what you said on FreeCamera and yes when i press a key the camera moves in that direction but in a weird way, i guess because is a FreeCamera.Maybe with that i can fix it for the freeCamera, i will try tomorrow.

    Edit: If you say takes the camera rotation of the player in consideration maybe when we press forward(W) on Freecamera is add some (-Y rotation) coordinates or similar to respect the controls? More things to try.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)