Jump to content

Search the Community

Showing results for tags 'camera intersectmesh'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. What I wanted to do A camera that can move forwards, backwards, up and down and rotate to the left and to the right and up and down. The front of the camera will be a distance of B from the front of the camera The camera should be blocked from moving forward when its front is in contact with an object;backwards when its back is in contact with an object;up or in an up rotation when its front top is in contact with an object;down or in a down rotation when its front bottom is in contact with an object;in a left rotation when its front left is in contact with an object;in a right rotation when its front right is in contact with an object.How I achieved this B is set to 60 in the z direction I constructed a viewer which consists of a holder ( a box mesh) which is a parent to six planes (plane meshes) one plane for each of the front, back, top, bottom, left and right of the holder.. The planes are called viewer.front etc. The holder dimensions are 6 in the x and y axes and 60 in the z axis and its centre is at the origin. I created a camera the position of which is always set to the position of the viewer.back.The camera looks in the z direction when created. The long axis through the holder is the line of sight. A target for the camera is set in the distance, for example at position (0, 0, 780). The target is given the holder as parent. This as the holder is moved and rotated the target is always along the line of sight and the same distance away. The numeric keypad is used to move the camera. 5 move forward, 0 move backward, 4 rotate towards left, 6 rotate towards right, 8 move up, 2 move down, 7 or 9 rotate up, 1 or 3 rotate down. Collisions are checked using intersectMesh between each of the planes and all of the objects in the scene and knowing which planes are blocked prevents movement in those direction only. A working example. http://www.babylonjs-playground.com/#AGEQ3 shows the code and how it was achieved. (Slight problem you need to move the mouse on the playground before the scene is rendered, once rendered it works -- don't no why???? probably something stupid I have done!!!!). Question Given the range of Babylon cameras there must be a more efficient way to do this. Any advice gratefully received.
×
×
  • Create New...