Questions tagged [raycasting]

A rendering technique to create a 3D perspective in a 2D map

1193 questions
3
votes
1 answer

Is there any way to stop raycasts from going through objects?

Im making a grappling gun, that pulls an object towards the player if the layer is LightWeight, and pull the player towards the object if the layer is Ground int groundLayer_mask = LayerMask.GetMask("Ground"); int…
3
votes
2 answers

Interact with UI via RayCast Unity

Hi2, I have (a very simple, i think) problem. How do I detect & interact with the Ui Element that is currently being "raycasted" ? The figure below shows what i want to achieve: I have this code from Unity Documentation void FixedUpdate() { int…
Hikari
  • 458
  • 1
  • 11
  • 27
3
votes
1 answer

Three.js raycasting does not work on DIV which is not full screen

I wrote a simple web page displaying a 3D bone and using Three.js raycasting to draw dots and lines on it and it worked perfectly well. result of using raycast on full screen web page But when I ported it to another web page having multiple windows,…
Ringo Work
  • 33
  • 5
3
votes
1 answer

Raycaster doesn't detect rotated objects

I'm new in Three.js and I'm trying to find out, why is raycasting not finding some parts of rotated mesh object. For example, on the image bellow, mouse at position of green circle is detected, like it's on the Box, so intersectObjects return array…
Petr Nečas
  • 426
  • 3
  • 11
3
votes
1 answer

Why is Vector3 not updating Unity3d

I have been losing my sanity on this for a while now. Just disregard the part which is commented out (Not the problem). I am trying to do a 360 degree longitude and 180 degree longitude sweep and then raycast. But apparently the direction vector…
3
votes
1 answer

How do I fix the warped perspective in my raycaster?

I am writing a raycaster using SDL's C API. I have spent weeks trying to fix the notorious fisheye effect to no avail. According to this source, I can multiply my calculated distance by the cosine of half of the FOV to fix it. That has not worked…
Caspian Ahlberg
  • 934
  • 10
  • 19
3
votes
1 answer

Interactive mouse picking/selecting of curves with OpenGL

This is NOT about how to create and render curves (e.g. Bezeier, NURBS, etc) BUT about how to be able to interactively 'pick' such curves by mouse click when the mouse cursor is hovering over ANY part of such a curve. After doing the required…
DavidH
  • 97
  • 6
3
votes
2 answers

Raycasting Voxels and OpenGL

I'm currently looking into raycasting and voxels, which is a nice combination. A Voxelrenderer by Sebastian Scholz implements this pretty nicely, but also uses OpenGL. I'm wondering how his formula is working; how can you use OpenGL with raycasting…
RobotRock
  • 4,211
  • 6
  • 46
  • 86
3
votes
1 answer

Galaxies simulation: Change color of a point and display text on mouseover

I am trying to create a simulation of positions of 4673 of the nearest galaxies. The galaxies are points. I want to color a point on mouseover and load the name of the galaxy. I have spent many days trying to achieve it. I am able to change color,…
Ritesh Singh
  • 279
  • 1
  • 4
  • 19
3
votes
2 answers

Offseting a Ray from camera before casting

Hello dear Unity game developers, Today i have a question that seemed easy but i had a hard time solving it. In order to explain what i'm trying to achieve i made a simple illustration. I am current developing a simple mobile game which uses drag…
3
votes
1 answer

How do I make raycast hit with a canvas element(screen space overlay)

For some reason, my 2D Overlay is not reacting to the raycast hit while the 3D objects work fine. I've searched the internet for quite some time now and I still can't find a solution to it. (I'm kinda new-ish to both C# and Unity so my knowledge is…
Levin
  • 65
  • 1
  • 2
  • 10
3
votes
2 answers

Raycast an object to enbable a mouse click event with Three.js

I'm adding objects to a scene for each entry in a database. I had a cube appearing in the scene for entry, but when I tried to add raycasting to click on objects it doesnt work, the objects dont appear and the console reads "Expression…
Nancy Collins
  • 197
  • 4
  • 13
3
votes
1 answer

Move object using Raycast hitpoint with offset

I am trying to create a simple ObjectMover class to move objects within a base (think Clash of Clans base editing). The issue I am having is that when an object is selected using a RayCast it jumps to the RayCast hit.point as the collider for the…
akaBase
  • 2,178
  • 1
  • 18
  • 31
3
votes
1 answer

Imprecise raycast with orthographic camera in three.js

I'm developing a 2d viewer of CAD drawings using the three.js library and for this project I need to be able to click the objects in the scene to do some operations. Using orthographic camera the three.js raycasting is not precise as I expect. Here…
3
votes
1 answer

Incorrect tracing with SSLR (Screen Space Local Reflections)

While implementing SSLR, I ran into the problem of incorrectly displaying objects: they are infinitely projected "down" and displayed in no way at all in the mirror. I give the code and screenshot below. Fragment SSLR shader: #version 330…
congard
  • 945
  • 2
  • 10
  • 28