Search the Community

Showing results for tags 'draw rectangle'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 1 result

  1. Hi! I'm trying to create unit (mesh) selection as it is in various strategy games(AoE, CnC (attached image) ...). After some exploring, I've came to the following, but there are a couple of steps I don't know how to do: 1. Hook to events (OK - trivial) 2. Draw lines using BABYLON.Mesh.CreateLines - at what position? Set LineMesh parent to camera? How to translate mouse position (scene.pointerX and Y) to world coordinates? Just draw rectangle and and set transformation matrix to identity (4x4)? Canvas 2d and 3d context can't be used together. 3. Once that is known, visible meshes are selected with octree (frustum plane is created and used for selection via method). But frustum plane can be very small and very close, or very big and far away (but this it's probably solved at step 2) I haven't really got to point 3. (got stuck at 2) so it's only my speculation. I'm open to suggestions if there are any better options . Explanation for attached image for non strategy game players: Green rectangle was drawn simply clicking in one corner and dragging. It's always orthogonal to camera view and at the same position (also based on camera) even if camera is moved or rotated. Its rendered above everything and every unit inside is selected. Thanks!