Jump to content

Camera seeing through terrain


Recommended Posts

Hi All


Am having a issue with my camera, when I try and walk up my terrain i can see through it.

I have base my code on http://www.pixelcodr.com/tutos/shooter/shooter.html

But I have added @NasimiAsl infinity terrain to my code.


I have attached a image of the issue am getting and all my code can be found here https://github.com/codeiain/MMORPG/tree/Develop/src/providers/GameService


I have been banding my head against this all day so any help would be great.

Screenshot 2017-04-24 18.04.56.png

Link to comment
Share on other sites

you can use collision too

 scene.collisionsEnabled = true;

    //Then apply collisions and gravity to the active camera
    camera.checkCollisions = true;
    camera.applyGravity = true;

    //Set the ellipsoid around the camera (e.g. your player's size)
    camera.ellipsoid = new BABYLON.Vector3(1, 1, 1);

    //finally, say which mesh will be collisionable
    mesh.checkCollisions = true;



and look line       // camera.position.y = 5.+height_Map(camera.position);

after you use collition you dont need this


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...