raycasting

Three js raycasting OBJ

大憨熊 提交于 2019-12-21 04:08:58
问题 Hello! I ve got an three js and tried to use it with my project. The thing is - i needed to select my custom mesh loaded from OBJ file. I created simple raycaster, simple cube, and my model (which is cube also). The thing is - i can have cube raycasted but it doesn t see my model. Where can i have the problem? var container, stats; var camera, scene, projector, renderer; var particleMaterial; var textureLoader; var modelLoader; var objects = []; init(); animate(); function init() { container

Changing Raycaster position dynamically

梦想与她 提交于 2019-12-19 11:39:11
问题 I have a canvas, inside that I have several cubes. I use Raycaster to select them and change their colors. But the canvas is inside of a draggable object and when I move around I cannot change the colors, the color changing works in the original position. I think I also have to change the dimensions of the Raycaster. How can I do that? Here is the example. 回答1: try to change a code as follows: function onDocumentMouseDown( event ) { event.preventDefault(); var x = event.offsetX == undefined ?

GPU ray casting (single pass) with 3d textures in spherical coordinates

为君一笑 提交于 2019-12-19 10:04:47
问题 i' am implementing an algorithm of volume rendering "GPU ray casting single pass". For this, i used a float array of intensity values as 3d textures ( this 3d textures describes a regular 3d grid in spherical coordinates ). Here there are example of array values: 75.839354473071637, 64.083049468866022, 65.253933716444365, 79.992431196592577, 84.411485976957096, 0.0000000000000000, 82.020319431382831, 76.808403454586994, 79.974774618246158, 0.0000000000000000, 91.127273013466336, 84

Raycasting algorithm with GPS coordinates

て烟熏妆下的殇ゞ 提交于 2019-12-19 04:08:28
问题 I'm making a small application with Google maps that determines if an entered address is part of a predefined service region. The user enters an address, and a PHP script fetches the lat/long from the Geocoding API and applies raycasting with a bunch of coordinates that make up the vertices of the region (taken from a KML file Maps generated). The problem is this: it works most of the time, but some addresses outside the service region incorrectly report as eligible, while some others inside

three.js 3d models as hyperlink

被刻印的时光 ゝ 提交于 2019-12-18 12:37:47
问题 I'm trying to figure out a way to use a 3D model created with Three.js as a hyperlink. In other words, if I click on a cube (a THREE.CubeGeometry), I want another page to open. For instance, in this threejs.org example, how can I change it, so that instead of making little dots on the boxes, clicking on the boxes would open another page, like a hyperlink? 回答1: One way to achieve it will be to associate custom userData(URL) with every cube while its being created. So here is a sample code how

Why do I get bad performance with SDL2 and SDL_RenderCopy inside a double for loop over all pixels?

。_饼干妹妹 提交于 2019-12-18 06:49:57
问题 I am programming a raycasting game using SDL2. When drawing the floor, I need to call SDL_RenderCopy pixelwise. This leads to a bottleneck which drops the framerate below 10 fps. I am looking for performance boosts but can't seem to find some. Here's a rough overview of the performance drop: int main() { while(true) { for(x=0; x<800; x++) { for(y=0; y<600; y++) { SDL_Rect src = { 0, 0, 1, 1 }; SDL_Rect dst = { x, y, 1, 1 }; SDL_RenderCopy(ren, tx, &src, &dst); // this drops the framerate

THREE.js Raycasting from a child camera to the scene

故事扮演 提交于 2019-12-18 06:09:18
问题 I am trying to raycast the mouse from my camera to do some hover and click events on meshes in my scene. My problem is, that my camera is currently the child object of another mesh (for easier camera movement/rotation) and now my raycasting doesn't work (I assume because the camera is a child of the mesh, and not the scene). This is parts of my code: //camera setup var camera = new THREE.PerspectiveCamera(60, window.innerWidth/window.innerHeight, 0.1, 1000); var cameraTargetGeom = new THREE

3D Screenspace Raycasting/Picking DirectX9

醉酒当歌 提交于 2019-12-17 21:35:31
问题 I need to convert a 2D mouse coordinate to a 3D world coordinate based on a specific depth (it's for raycasting). I'm not directly using DirectX in C++, I'm using a proprietary language, but if you give me an answer in C++ or pseudocode (C++ preferred) I can convert it. I have access to the world matrix, view matrix and projection matrix and a variety of matrix manipulation functions. If it's necessary to multiply a vector4 by a matrix4, the only function I have available that takes both a

Unity Physics2D.Raycast hits itself

落花浮王杯 提交于 2019-12-17 17:16:17
问题 I'm trying to use Physics2D.Raycast in order to check if the player is on the ground (I know that there are other approaches to check if the player is on the ground but I think that the raycast is the most reliable). The problem is that in my scenario it returns the player itself as hit and I really don't understand why and what should I do. My code (in PlayerController ) is the following: public bool IsGrounded () { Bounds bounds = this.playerCollider.bounds; Vector3 rayOrigin = bounds

raycast wont hit collider after using NGUI?

早过忘川 提交于 2019-12-13 07:35:56
问题 after turn the main UI framework to NGUI, we found that We couldn't hit object with collider anymore with following code which was working fine we not using NGUI: private void checkRayCast() { if ((Input.GetMouseButtonDown(0))) { Debug.Log("shoot ray!!!"); Vector2 point = Camera.main.ScreenToWorldPoint(Input.mousePosition); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit2; if (Physics.Raycast(ray, out hit2, 100)) { //this should hit a 3d collider Debug.Log("we may