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
1answer
25 views

Calculation of perpendicular distance to camera plane explanation

I am following this tutorial for a Wolfenstein 3D engine. https://lodev.org/cgtutor/raycasting.html Here is the relevant image from the tutorial: I cannot figure out how dividing by rayDirX or ...
1
vote
1answer
33 views

Unity raycast equivalent in Unreal

I've been moving from Unity to Unreal and I'm finding it difficult to grasp the Raycast (Trace) logic of Unreal. The use case I'm trying to implement at the moment is to trace a ray and check if I ...
0
votes
2answers
24 views

Help needed in getting the correct hit position a raycast hits a sphere in Unity

I'm trying to get the actual position a raycast from a controller hit's a sphere gameobject. The raycast is cast from the controller (gear vr controller) out in the forward direction when the trigger ...
0
votes
1answer
25 views

Using a object as origin for a Raycast using mouse position as direction

Is there any way to cast a ray from an object using the mouse position as the direction for the ray? I´ve been looking for a while but I can´t find something like that anywhere, so if anyone could ...
0
votes
1answer
48 views

Fishbowl effect correction in raycasting engine suggestions (pseudo 3d projection)

I'm writing a simple raycaster in golang and I have some problems understanding perspective correction. The code is simple, the main rendering loop is this: ...
0
votes
1answer
47 views

Raycast against a mesh without using a mesh collider?

I have a complicated mesh that doesn't need to have anything to do with physics. However, I need to be able to detect said mesh with a raycast from a point. I have several hundred of these objects ...
0
votes
2answers
43 views

2d Raycast detection doesn't work

I want to check if the position I generated has another object or not. I do this by using Raycast: ...
1
vote
1answer
33 views

Raycast check for Collisions across XZ coords without Y rotations / Unity C#

I'm really new to Unity/C# (I have a bit of experience in GML but far from professional) and I am currently building out my first prototype. I originally copied THIS script to get a cube that rotates ...
0
votes
1answer
37 views

Why aren't the Physics2D.Raycasts reliably colliding with the 2D Box Collider walls?

I've got this NPC walking around and I'm trying to create a cone to represent their line of sight, including how it would be blocked by buildings, similar to how Nicky Case has implemented it as ...
0
votes
1answer
38 views

Collider null using LayerMask

I am trying to implement jumping in my game. I am casting a ray to know if the player is grounded, and using a Layermask to make it only react with the floor. The code: ...
1
vote
1answer
56 views

Raycast wrong direction

I use Physics.Raycast and transform.forward to shoot a ray in front of my gameobject, but the ray gets cast downwards instead. <...
0
votes
1answer
63 views

why does Physics.Raycast always return my player game object instead of the object I clicked?

I have 3D world. I want to detect when the player clicks on a game object in the world. In this image, I have 2 objects I want to detect mouse click on. The white sphere does have collider on it. The ...
1
vote
0answers
29 views

Why is unity's RaycastHit2D contact point is slightly off

This is a small test I made, basically I have a simple BoxCollider2D that has the top surface aligned with the x axis. It's just a ...
0
votes
0answers
48 views

How can I implement ground clamping across slopes in my 2D collision controller?

I'm working on improving my 2D collision controller, but am having trouble with "ground clamping" when my object moves past certain slopes on which it should be descending. The controller takes the ...
0
votes
2answers
123 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
142 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
38 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
165 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
49 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
35 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
36 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
257 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
172 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
235 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
35 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
31 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
37 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
164 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
450 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
53 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
31 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
397 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: ...
1
vote
1answer
261 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
231 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
155 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
93 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
49 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
102 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
420 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
79 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
250 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
255 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
80 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
97 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
79 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
84 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
245 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
243 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 ...

1
2 3 4 5
7