Questions tagged [raycasting]

A technique for using rays to determine points of intersection. Often used in lighting simulation.

Filter by
Sorted by
Tagged with
0
votes
2answers
96 views

Why don't raytracing algorithms include the speed of light?

From what I understand about ray-tracing, it is instantaneous in its speed from the light source to the user. Is there a type of ray-tracing where the "rays" move at the speed of light or are affected ...
0
votes
2answers
30 views

unity: input event consumed by image raycast target that is “under” a sprite with a 2D collider

I am having a hard time getting my UI to work. Basically I have a canvas with a UI image A that is the size of the screen. This image has raycast enabled and if effectively receiving inputs. Not in ...
0
votes
1answer
23 views

RayCast node always return null

I'm using RayCast node to check the object is grounded. Here's the setting: RayCast node is placed near by ground and the length enough to collide with ground. Also RayCast node is enabled. RayCast ...
0
votes
0answers
20 views

Unity 3d Raycast from localspace to worldspace

I want a raycast direction not relative to the rotation, but what happens is that the raycast points to one place as if it was a transform.forward Why is the happening help ...
1
vote
1answer
75 views

3D line segment AABB collision, with hit normal?

I'm embarrassed I can't find this, but I'm wanting to detect intersection with a 3D line segment (not an infinite ray) with a 3D AABB, the AABB being defined as two Vec3f's which represent the Min and ...
1
vote
0answers
37 views

RayCasting with Mode7

I'm trying to join the mode7 algorithm with RayCasting. For mode7, I'm using a simple rotation matrix to implement the rotation. The result is a little strange and I can't fix it. Do you know what is ...
0
votes
1answer
30 views

How to raycast from a UI element

How do I raycast from a UI object? I have tried Ray ray; Camera cam; Transform obj; //UI object ray = cam.ViewportPointToRay(obj.position); AND ...
0
votes
0answers
29 views

RayCasting picture noise render method

I'm creating a RayCasting tutorial on github (click here to access it) and I'm following a lot of tutorials, implementations and other render methods in the web. One game made with it is the "Prelude ...
0
votes
1answer
67 views

Unity Raycast not detecting layers

I am having problems with layers detection using raycasts. Context: I created a grid to use in a pathfinding algorithm on a 2D plane. I want to implement now different weights according to the layer ...
1
vote
3answers
118 views

How can I offset a direction when raycasting?

I'm trying to figure out how I can best offset a direction when raycasting. So let's say I have an object and I want to cast a ray from my mouse position to said object, that's easily done with (for ...
1
vote
1answer
154 views

What is a raycast?

I use this script to build buildings on my terrain, and it works with the collider somehow. But I don't understand what it is that the raycast does to find the right place to put my building. ...
2
votes
0answers
33 views

How to properly interact with game objects in Unity3D? [closed]

I am trying to make a game where player will be placed in the scene and the goal is to explore it. He can interact with game objects that player can find in the environment, like picking object, ...
0
votes
1answer
27 views

Can a Unity button detect a tap AND send that tap through to objects below it?

I'm trying to make a "highlight frame," like a flashing box around a button for use in the game's tutorial. When the frame is tapped, I'd like it to register the tap (so the frame can be dismissed) ...
0
votes
1answer
35 views

Unity3d: Find a point on the line which has shortest distance from the third point

So, initially, I had points A and C. To get point B, I had to shoot a raycast down from ...
0
votes
0answers
63 views

Three js raycaster WITHOUT camera

I seem to find only examples to use the raycaster with the camera, but none that just have a raycaster from Point A to Point B. I have a working raycaster, it retrieves my Helpers, Lines etc. but it ...
0
votes
1answer
179 views

Unity3d: Get a direction vector parallel to plane

I need to send a raycast from my camera which is parallel to the plane (Ground) and in the same direction of its forward vector (Represented by the black color vector) I cant use world space ...
0
votes
0answers
38 views

Screen to world raycast imprecision

I am trying to convert screen point (mouse position) to ray in world space. It works, but it lacks precision. Here is the code: ...
0
votes
0answers
27 views

Whats the most efficient way to implement precise ray picking for scenes with large meshes?

I'm wondering how to implement ray picking in the most efficient way for scenes with very large meshes ( > 1 million faces)? Right now I'm using BulletSharp physics wrapper with TriangleMesh which ...
0
votes
0answers
208 views

Unity Raycasting only hitting mesh colliders from particular directions

I have a game which involves clicking to select some objects. Each of the objects has a mesh collider attached to it so that objects can be clicked, handled by the following: ...
0
votes
1answer
160 views

C++ Mouse picking for ray to plane intersection

I'm making a C++/OpenGL application (decidedly without GLM), and I'd like to understand how to create a ray from the camera eye to the mouse pointer, as well as detect an intersection point from the ...
1
vote
2answers
199 views

Efficient collision detection of sphere with wall

I'm building a first-person game where up till now the player has been represented as a dimensionless point; this makes collision detection really easy, as I can just cast a ray along their velocity ...
0
votes
0answers
146 views

Raycast collision Detection different results?

So I'm trying to make a collision detection system for a kinematic rigidbody for a gameobject but for some reason the results in which the gameobject stop is always different. I tried missing around ...
0
votes
0answers
38 views

Problem with repeating objects in array when already in the array

When the player move forward then paint is instantiate and stored in the array, even if the paint is already in the array it will again be stored in the array. But I don't want to repeat any paint in ...
0
votes
1answer
83 views

How to detect when the player has filled a shape?

In my game, the player is presented with a plane containing obstacles (orange / blue) and regions of empty space (white). The player moves their green cube around the empty space, which instantiates ...
1
vote
0answers
41 views

MousePicking in LWJGL - How to do it?

I have been working on a mouse picker for a scene in 3d for a client, and been having issues implementing a proper mouse pick. His application does not use a camera, and I am trying to get the ray ...
0
votes
2answers
59 views

How to check if a specific instance of a prefab is pressed?

This one is hard to explain, so I'll show the code first - ...
0
votes
1answer
189 views

Raycasting from an object to the center of the screen (crosshair) without clipping through objects

Am trying to learn about Raycasting, and I thought I would start with something simple, and that was a laser that would come out of an object (think laser pointer in your hand) and always go to the ...
0
votes
2answers
56 views

Perform intersection (horizontal and vertical) checking in raycasting

I want to check the horizontal and vertical intersections on my raycasting view, and I can't exactly understand what is ALPHA using this drawing source : https://www.permadi.com/tutorial/raycast/...
0
votes
1answer
154 views

Raycasting center of camera is not working: why?

In my game i'm using Unity First Person controller. I check every second what I am looking with the following code: ...
0
votes
1answer
157 views

Understanding the rendering of the raycasting on flat screen

I have a misunderstanding of the raycasting formulas on flat screen because my rendering is not what I expected, this is some parts of the code to show my projection formulas that I wrote by myself ...
1
vote
1answer
75 views

Unity3D Raycasting in Start behaves uncorrectly, but works correctly in Update?

I have this method, which just raycasts at a position downwards, and checks what tile is there, if there is one: ...
0
votes
1answer
72 views

Finding the on-screen height of straight walls in raycasting rendering

I have an issue to find the correct height of walls to make them straight in raycasting rendering. This is how I calculate the height of the wall which is h_seen: ...
0
votes
1answer
65 views

Rendering a raycasting view

I am trying to reproduce the raycasting of the game Wolf3D. I read this tutorial, but I am struggling to understand how to code the intersection between the rays and the walls by using angles and ...
1
vote
1answer
81 views

What are some gameplay cases where knowing the Z as a result of the raycasting is useful in a 2D setting?

The context is an 3D engine with a 2.5D level format. Like a roller coaster tycoon level, with some other level features added, and layers removed. For example the tile functions have the following ...
0
votes
1answer
159 views

Unity AudioSource.PlayClipAtPoint - controlling attenuation

New developer here, looking to do some raycasting and controlling audio positioning in 3D space based on the raycasts interactions with other objects. I've got the raycast 'casting' and able to report ...
1
vote
1answer
187 views

Rigidbody & Ray alternative or optimization

I am creating an AI that moves around to certain points, but should interact with ais or objects seen. The ai should find other ai to comunicate or look for objects on the ground. It works with all ...
0
votes
3answers
115 views

In 2D, how can I improve character rotation using raycasts when dealing with sharp/convex edges?

Edit: After making some edits to my polygon collider (based on @Alex F's suggestion), I can indeed confirm that sharp, convex corners are causing the buggy ...
1
vote
1answer
127 views

Unity SphereCast HitInfo Give me an interpolation of the normal surface?

I'm doing a SphereCast for a GroundCheck of a player. I have my Raycast hitInfo, and here in the picture at the left, I Debug.drawRay in black the direction of the hitInfo.normal every frame It seems ...
0
votes
0answers
45 views

How to implement Microwave Signals in Unity?

I need to implement microwave signals for object detection in Unity. I know there are raycast sensors in Unity, but can microwave signals be simulated or can a proxy of microwave signals be created ...
3
votes
1answer
133 views

Why does my collider rotate correctly on a slope only when a ray is cast directly from its center?

Edit: This answer might also be helpful to those who come across this question. I've been messing around with raycast collisions and slopes, but am having an issue when trying to get my collider to ...
0
votes
0answers
25 views

Check gap in 3d environnement

I am in a 3d environnement, when I jump, i'm calculating the hitPoint of the end jump. I want to know when I jump, if there is a GAP between my initial point, and the end point. But I don't want to ...
2
votes
1answer
252 views

How to detect when the mouse is over a particular enemy collider, without falsely selecting bullet colliders?

I have an enemy shooting around. My game mechanic involves hovering over the enemy with the mouse to drain its health. While the enemy is moving, you need to follow it with your mouse. If you don't ...
0
votes
1answer
83 views

Raycaster calculation question

I am following this tutorial https://lodev.org/cgtutor/raycasting.html When deriving deltaDistX geometrically you get, with Pythagoras, the formula "sqrt(1 + (rayDirY * rayDirY) / (rayDirX * ...
0
votes
2answers
143 views

Difference between reflection mapping and raytracing

Both methods involve casting a ray unto the reflecting object. It will be reflected. In reflection mapping - the intersection of this reflected ray with the environment map (texture) will yield the ...
0
votes
1answer
77 views

Can't figure out why my mouse picking code doesn't work

I am trying to create code to check for intersections between bounding spheres and the mouse. I get a mouse ray but it doesnt seem to point in the direction you think it should Attached is a ...
0
votes
0answers
16 views

rayTest for cutted by stencil objects

I have red rectangle based on which I am cutting (using opengl stencil) all of the green rectangles, like shown in the following screenshots a) before cut b) after cut When I run rayTest(bullet ...
1
vote
2answers
74 views

How can I check if the mouse hits a quad in 3d, and where it hits it?

I have a sketch that produces the following: ...
0
votes
0answers
26 views

The Raycasted plane (surface) ascend or descend with my camera

I would like to be able to draw an infinite plane in order to do multiple FX (such as a fog floor) later. I used the following shader that works except that the plane (surface) seems to follow my ...
0
votes
1answer
185 views

Raycast does not go to target position

There is a part in my script where I need to make a raycast check from my gun's muzzle to the enemy. This enemy could be anywhere around player. I found my ray is not connecting to the target ...
2
votes
3answers
268 views

Get closest point on box to line

Eventually this problem will be 3D, so I would like a solution that works in 3D. My player is looking forwards. There is an axis-aligned box on the screen (FOV is guaranteed to be 90, so boxes behind ...