X3M's Recent Forum Activity

  • Colludium The reason why it doesn't work is because the statement "this" is encapsulated inside the instance prototypes scopes. So it cannot pass the borders towards other functions, therfore you should pass it as a paramter if you're planning to make your own function outside the .prototypes. If it is a function of a library such as Box2D , which is the case here, you should assign it to a global variable declared outside the scopes.

    Like this:

    var _this;
    instanceProto.onCreate = function () {
    _this = this;
    this.gravFactor = this.properties[8];
    ....
    }
    
    Box2D.Dynamics.b2Island.prototype._InitializeVelocities = function(step, gravity){
     alert(_this.gravFactor);
    ....
    }
    [/code:348r2k3p]
    
    Use _this inside the Box2D functions
  • matriax Glad you got it working, are you making a minecraft like game ?

  • 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 Can you send me the capx please ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.
  • 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

  • MATAGUIRIS Here is an example

    Here is a fully detailed explanation:

    As you know, obj models are widely available on the Internet, but the modellers can be sometimes noobs and they don't set the pivot to the center of the model or sometimes the scaling factor of the pivot is not 1. Or sometimes the obj can be composed of several meshes which is a problem. So to solve this problem I added an extra mesh which will act as a parent, you can see it if you set Debug to True in the OBJ properties.

    So when you import an obj model, you need to see if the debug mesh fits perfectly to the obj, if not then you should use those XYZ scaling and offset parameters to adjust fit the model.

    And finally you activate collisions for the mesh debugger.

    matriax Oh I see so it's for Nvidia only ?

  • matriax It would be better if you matched the scene skycolor (Clear color) with the fog color, your video looks smooth, is it a 60 FPS video ? what screen recorder are you using ?

  • Psychokiller1888 I've just added the On released conditions.

  • matriax Oh I didn't pay attention to it

  • matriax I forgot about those, I'll be adding them in the next update, now I'm working on some tutorials : https://x3mworks.blogspot.com/p/babylon ... rials.html

  • matriax The mouse lock works, but the camera does not exceed 360 degrees, the devs made it this way to simulate a human head , which cannot rotate 360 degrees like an owl for example. So you can look right and left but not back, if you wanna look behind you will need to step diagonally just like in real life.

    Also the mouse lock works better if you go to fullscreen mode.

    About the FPS problem, try setting the scene native gravity on the Z axis like (0,0,-9.8) this way the camera will drop forward, but then you will have to find a way to make the camera stand on the Z axis and not act as if its laying on the ground.

X3M's avatar

X3M

Member since 8 Jul, 2016

Twitter
X3M has 1 followers

Trophy Case

  • 8-Year Club
  • Coach One of your tutorials has over 1,000 readers

Progress

9/44
How to earn trophies