Babylon3D: Standard Edition

Post your completed addons to share with the community

Post » Fri Jan 13, 2017 11:58 am

@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
Banned User
B
17
S
7
G
24
Posts: 388
Reputation: 14,494

Post » Fri Jan 13, 2017 12:14 pm

@X3M Ah ok!

I fixed the camera problem with this expresion to convert radians in degress in case somebody needs too:
Image
(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.
B
25
S
10
G
3
Posts: 581
Reputation: 4,564

Post » Fri Jan 13, 2017 1:22 pm

@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 :
Code: Select all
   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);
   };

But for the camera it's :
Code: Select all
   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);
   };


You can temporally fix it by changing it to :
Code: Select all
   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));
   };


It's line 481 inside the babylonNewCamera/runtime.js

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.
Banned User
B
17
S
7
G
24
Posts: 388
Reputation: 14,494

Post » Fri Jan 13, 2017 2:03 pm

@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.
B
25
S
10
G
3
Posts: 581
Reputation: 4,564

Post » Fri Jan 13, 2017 6:28 pm

@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.
B
25
S
10
G
3
Posts: 581
Reputation: 4,564

Post » Fri Jan 13, 2017 7:25 pm

@matriax Can you send me the capx please ?
Banned User
B
17
S
7
G
24
Posts: 388
Reputation: 14,494

Post » Sat Jan 14, 2017 4:24 pm

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.
B
25
S
10
G
3
Posts: 581
Reputation: 4,564

Post » Sat Jan 14, 2017 5:27 pm

@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%.
Banned User
B
17
S
7
G
24
Posts: 388
Reputation: 14,494

Post » Sat Jan 14, 2017 5:34 pm

X3M wrote:@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
B
25
S
10
G
3
Posts: 581
Reputation: 4,564

Post » Sat Jan 14, 2017 6:26 pm

Ohhh i think i fake it the Camera real gravity :P , a bit dirty but works. Every time you fall more faster, when collides with whatever object(on Y) set to 0 and when no object is under your feets increases from 0 to X every tick :D .

Still a bit dirty but is working. I'm going to test it all better....
B
25
S
10
G
3
Posts: 581
Reputation: 4,564

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests