• Content count

  • Joined

  • Last visited

  1. Robin

    Texture Scale

    Thank you for the reply. My camera is located same with the demo. But I used a box and scaled the y axis instead of calling the ground function. (Because I want the ground has a little thick) As u know, box has six faces; a ground has only one. What I can guess is, uScale=2 indeed repeat texture twice along u axis. For the box, the u axis of its front face is along x axis; while the u axis of its top face may along y axis. Correct me if I am wrong. Thank you.
  2. Robin

    Texture Scale

    Hi guys, I am confused about texture uScale and vScale, and need some help. Below is my code and a screenshot of the result, which is opposited to what I expect. For my understanding, uScale=2 will repeat image twice along x axis. Thank you. var groundMat = new BABYLON.StandardMaterial("ground", game.scene); groundMat.diffuseTexture = new BABYLON.Texture("assets/ground.png", game.scene); groundMat.diffuseTexture.uScale = 2;
  3. Robin

    Reset Ball after Falling Down

    mesh.rotationQuaternion.copyFromFloats(0,0,0,1); Sorry for late reply, I just move house recently. The code above works for me!
  4. Robin

    Reset Ball after Falling Down

    this.rotationQuaternion = BABYLON.Quaternion.Zero(); I tried the code above, but it does not work. A purple screen will be displayed forever. I do not quite understand the API description below. It seems that this attribute is read only?
  5. Hi Guys, I followed the eBook to create this super monkey ball game. When the ball fell off the cliff or spiked by the spikes, it will be reset to the start position with a height of 5, then it will drop and rest on the block. Oimo.js is used as the physics engine. Below is my reset function: Player.prototype.reset = function(pos){ this.impostor.setLinearVelocity(BABYLON.Vector3.Zero()); this.impostor.setAngularVelocity(BABYLON.Vector3.Zero()); this.directions = [0,0]; this.rotations = [0,0]; this.position = pos; this.position.y = Player.START_HEIGHT; this.rotation = BABYLON.Vector3.Zero(); }; My question/issue is: After falling down the cliff, and resetting the ball, the ball will not be upside up sometimes. i.e. when I push it to go forward, it will jump up instead. When I rotate it to left, it will rotate to right. Do you have any idea about this issue? Thank you very much.
  6. Robin


    Background: I am reading the Babylon.js ebook - Chapter9 Collision, and find a line of code: var body = mesh.setPhysicsState(BABYLON.PhysicsEngine.BoxImpostor, {mass:0, restituion:0.5, friction:0.5}); This function will return an instance of the rigid body, i.e. Oimo.Body. However, I run the code, and an error is raised, says the function setPhysicsState is undefined. Question 1: Is that true the function is removed from API forever? Question 2: Once physics impostor is added to a mesh, e.g. sphere.physicsImpostor = new BABYLON.PhysicsImpostor(...), how can I move this mesh? Do I have to apply an impulse to the mesh or I can simply update the mesh position, such as sphere.positon.z += 1? Thank you.
  7. Robin

    Learning Babylon.js - The ebook!

    I just finished reading Chapter 5. Execuse my indolence, but is there some link I can use to download the resource, such as block texture and skybox images? BTW, it is really a nice and helpful book, especially for a beginner like me.