Questions tagged [raycasting]
A technique for using rays to determine points of intersection. Often used in lighting simulation.
455 questions
0
votes
0
answers
88
views
How to Implement Ray Casting and Aim Assist Scaling in UE5 Using C++ for FPS Mechanics?
I'm developing an FPS shooter in Unreal Engine 5 and currently working on the aiming mechanics for keyboard and mouse (KBM). I want to implement an aim assist system that uses ray casting to detect ...
0
votes
0
answers
60
views
How to use sensors and ray casting for collision detection in Pygame (using a custom Mask/sensor class)?
I am making a Sonic game in Pygame and I have recently gotten my hands on a Python class that uses pygame.rect and pygame.mask in unison to create sensors that can be used to accurately detect the ...
1
vote
1
answer
126
views
Why is my raycast not working?
I'm trying to ray-cast mouse clicks to the surface of a sphere (from which point, I'm going to get the coordinates of the vertex of the sphere's mesh that are closest to the click). The following ...
0
votes
1
answer
176
views
BSP Tree Troubles and Unpredictable Results
I've been trying to fix this problem myself for ages, but I really do need help. I'm creating a BSP tree for my 3D game (baked in the map files, quake style) to replace my existing naïve collision &...
0
votes
1
answer
106
views
Finding the index in a material where a raycast hit
I have a gameobject with a mesh collider. The mesh is simply a flat plane.
I raycast to the mesh and I'd like to get the index on the material's basemap where I got a hit.
I assumed ...
0
votes
0
answers
47
views
Ray-Sphere Intersection Always States Ray Origin Is Point Nearest Sphere Center
I am writing a simple graphics engine using Rusts WGPU. I have a Sphere rendering at the origin of my scene like so:
...
1
vote
1
answer
96
views
How to detect colored pixel of Sprite3D texture with perspective camera ray?
I've tried to ray cast my mouse position to Sprite3D on screen but I have some problems with it.
...
0
votes
0
answers
50
views
How to stretch a cylinder when dragging with a Ray Interactor?
I'm making a VR game in Unity.
I want to select a cylinder with ray interactor and drag it, and as I drag, it should stretch.
This is the code I have currently for 2D:
...
1
vote
0
answers
204
views
Problems with RayCasting after fixing fisheye distortion
I am writing a pseudo-3D game in Python. After I tried to fix the fisheye problem, a new one appeared - if you stand close to the wall and look so that the wall is on the side, then the borders of the ...
0
votes
1
answer
70
views
Can I insert sound in the tooltip?
Before this, I try to insert an image in a tooltip and it was already done. But right now, I want to try to insert a sound in the tooltip. What I want to do is when I point my cursor to the object it ...
0
votes
1
answer
240
views
How to make raycast go through platform effector?
I'm making a 2D game and I'm using a raycast.
I want the raycast to ignore the platform when hitting it from beneath, but not when hitting it from above.
Right now the raycast always hits no matter ...
0
votes
1
answer
753
views
Why does my XR ray refuses to cast on my UI?
I have about ten UIs with buttons in my scene. I can cast my XR Ray on all of these UIs and the buttons work fine except two. The buttons on these two UIs are clickable but the rays are not showing on ...
0
votes
1
answer
301
views
Buttons' hitboxes shift a bit lower when I maximize my game window
I have a simple scene in my Unity 3d project. There is a Canvas (UI Scale Mode in Canvas Scaler is set to Constant Pixel Size but the same is with Scale with screen size), Panel inside it (Stretched ...
0
votes
1
answer
1k
views
How do I add a pointer to my XR Interactor line visual?
I am setting up my project with XR Interaction toolkit. As usual, there are two red rays from the controllers after the set up as shown below.
However, I want the rays to appear exactly as it is in ...
1
vote
3
answers
2k
views
Explain how Inigo Quilez calculates SDF box normals
Inigo Quilez's website has a page of 3D ray-surface intersectors, one of which is for a basic 3D box:
...
2
votes
1
answer
369
views
Dealing with block corners in a grid-based raycaster
I'm trying to build a simple grid-based raycaster, but I'm having trouble with rendering block corners.
First of all, I want to change the color of all the y-axis walls. But a block's corner belongs ...
0
votes
1
answer
272
views
Enemy AI line of sight through Raycast won't behave as expected
I have an issue with my character controller. I'm using a raycast from the enemy AI as a line of sight in order to start following the player. My issue is that with my current character controller ...
0
votes
1
answer
430
views
Detecting Player by Raycasting
I am having a problem where my ray is unable to detect the player, even if I did layermask and went to draw ray and all other stuff.
Here is my code
...
0
votes
1
answer
2k
views
Does Raycast called from Update execute on next FixedUpdate?
I've been searching through the Unity docs (https://docs.unity3d.com/ScriptReference/Physics.Raycast.html), but no matter where I look, I couldn't find exact behaviour of Physics.Raycast() method.
I'...
1
vote
1
answer
515
views
Raycasting : computing x position of sprite on the screen
I am trying to create a raycasting engine using C and CSFML, I already have the walls and textures rendering done and right now I would like to be able to render sprites into the scene.
The difficulty ...
1
vote
2
answers
1k
views
Line-of-sight algorithm for tile-based tactics
I've tried Bresenham line and Raycasting, but they don't quite give the results I need (examples in the screenshot).
'&' - character
'+' - cells that can be attacked by the
character
'#' - walls
...
1
vote
0
answers
587
views
Raycasting to determine point inside or outside mesh, edge case?
I'm trying to determine if a point is inside or outside a (triangle) mesh.
The best way I found was to cast a ray from the point and count how many triangles intersect. (Odd or even).
I used Möller–...
0
votes
1
answer
5k
views
How to detect if hit by raycast from object with name/tag
INTRODUCTION:
In unity, I want to make a dynamic, object use system. Where the main player camera shoots a raycast when left mouse button is clicked and if an object that can be used for example a ...
1
vote
1
answer
138
views
Reflection Line2D
I found a video on YouTube with a sercol and a beam, and everything seems to be fine, but the beam doubles and flickers after spawning from the mirror, tell me what could be the problem, screenshot ...
1
vote
1
answer
151
views
Determine if a static mesh is lit by directional light
I want to determine if a mesh is lit by the directional light on my scene in editor to automatically disable its "dynamic shadow casting" property (let's say I have one light source in my ...