Skip to main content

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
0 answers
49 views

Why doesn't my Raycast detect AABB collision?

I have the following struct that calculates Raycasting: ...
Luigi Istratescu's user avatar
0 votes
1 answer
45 views

Mouse Ray Picking: Z-Coordinate of Projected vector (glm::unproject)

I've run into a curious issue when implementing ray picking in my game engine. It seems the Z coordinate of the Projected matrix has to be ever so slightly more than ...
Josh McCord's user avatar
0 votes
1 answer
43 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 ...
user1999728's user avatar
0 votes
0 answers
46 views

How to align to 2D ground surface directly underneath?

I'm out of ideas at this point. I'm trying to set up a function inside my player controller that aligns the player with whatever is under it (usually the ground), ive tried using Raycasts, collisions ...
Pow's user avatar
  • 383
0 votes
0 answers
33 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: ...
shaneB's user avatar
  • 1
0 votes
0 answers
47 views

Red raycast despite valid target in Unity VR

I have a question regarding Unity VR and Interaction Toolkit. When I point at a UI canvas element, the raycast turns from red to white (indicating that it is a valid target). However, when I create a ...
 d_test_2030's user avatar
0 votes
0 answers
41 views

Raycasting unable to detect water layer

I'm having issues detecting the ocean in my Unity scene (screenshot below) using Raycasting. In the image below, I've attached my script to a child object and set the layer for the Ocean object to ...
Akshit Chaturvedi's user avatar
1 vote
1 answer
38 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. ...
Pucka's user avatar
  • 13
0 votes
2 answers
96 views

Detecting collisions with trajectories

What if an object were to have collision detection implemented as so: A ray in the direction the object is moving in, and a ray in the direction of gravity.
Nato's user avatar
  • 9
1 vote
1 answer
179 views

Raycast suspension simulation rebounds car on landing

I'm expecting the car to land and engage the suspension to dampen the landing. The code I'm using currently has this effect: ...
Lousifr Illuminos's user avatar
0 votes
0 answers
19 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: ...
SPP's user avatar
  • 1
0 votes
0 answers
33 views

Casting out vision rays for 2D car in pyglet to return distance from objects?

I am working on a machine learning project that involves training a 2D car to drive around a top-down racing track. I'll be training neural networks using different algorithms and one essential form ...
Silvy's user avatar
  • 1
1 vote
0 answers
43 views

Offset in a raycasting algorithm

I'm trying to implement a function that takes a ray as its start and end position and returns all intersections with the map grid. I wrote following code and got a problem. Function returns correct ...
CalmlyGrass's user avatar
1 vote
0 answers
67 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 ...
kingley's user avatar
  • 11
1 vote
1 answer
221 views

Raycast from isometric view without camera position?

I'm trying to cast a ray so I can implement mouse picking. My game uses 2:1 isometric with a 3D world sim that uses AABBs. Positive X points to the bottom right, positive Y points to the bottom left, ...
Archduke's user avatar
0 votes
1 answer
33 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 ...
Hidayah__0111's user avatar
0 votes
2 answers
64 views

Display image by using tooltip

I want to display the image using a tooltip. So when I point to the 3dobject, it will display the image that I already created. Right now I already set the sprite in the tooltip but I have an error in ...
Hidayah__0111's user avatar
0 votes
0 answers
662 views

How does the UE5 Control Rig Sphere Trace by Trace Channel Work?

I would like to use a control rig to correct the foot IK. First, I defined a function called "FootTrace" to detect the ground under the feet. In this function, I used "GetTransform-Bone&...
Nater's user avatar
  • 1
0 votes
1 answer
139 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 ...
Andre Alvarez's user avatar
0 votes
1 answer
235 views

Fisheye effect on 3D projection

I'm rendering a maze with raycasting in Scratch. When I'm far away, the walls look nice, but when I'm near the walls they get a weird fisheye effect: Here is the code for the raycasting: And the ...
Scratcher's user avatar
0 votes
1 answer
350 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 ...
Craving_gold's user avatar
0 votes
0 answers
88 views

Enemy sprite with a raycast ground check is flipping even when it shouldn't

I have a 2D Sprite that patrols around a platform and is supposed to flip when it reaches the edge. The way the flipping is implemented is through Raycasts. There are two Transforms, on the Left and ...
Sternutation's user avatar
0 votes
1 answer
208 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 ...
crackanddie's user avatar
0 votes
1 answer
73 views

Platformer enemy with raycast to detect obstacles keeps changing direction rapidly

I am making a 2D platform and implementing a character similar to a Mario Goomba. This character will move left or right, depending on whether or not a raycast determines that there is an object in ...
TBG's user avatar
  • 25
0 votes
1 answer
688 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 ...
Craving_gold's user avatar
0 votes
1 answer
286 views

Why is Physics.CapsuleCast returning a mix of true and false when it should return only true?

I'm making a simple character controller. Each frame the player moves by moveDistance units in the moveDir direction. I'm ...
EEAH's user avatar
  • 113
1 vote
3 answers
903 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: ...
Nairou's user avatar
  • 584
0 votes
1 answer
420 views

Lots of objects with OnMouseDown VS Raycasting: Is one better than the other?

I have a grid of gameobjects with colliders. Currently they all have unity's inbuilt void OnMouseDown function which gets called when the mouse clicks on a collider. This then executes some game logic ...
iamconfusion's user avatar
2 votes
1 answer
186 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 ...
user avatar
1 vote
0 answers
258 views

Raycasting floor/ceiling textures sliding

I'm writing a raycasting engine in C++ and SFML. I have the wall texturing done and I'm trying to get floor and ceiling texturing right. I almost got it but the textures are "sliding" when ...
Xscreade's user avatar
0 votes
1 answer
204 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 ...
stratos la's user avatar
0 votes
1 answer
61 views

Score counter not increasing after recalling object from a pool with raycast detection hit

Context Hello, its me again. I have been playing around with "Object Pool" and it is fascinating the amount of CPU performance can save up. However, I have encountered a new "feature&...
Zeid Tisnes's user avatar
0 votes
1 answer
247 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 ...
Ujjawal Saini's user avatar
0 votes
0 answers
47 views

Wheel position on surface

I have a bicycle with suspension and need to find the contact point of the wheel on the "road". If the front fork was pointing straight down, it would be as easy as doing a raycast down the ...
Charl Cillie's user avatar
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'...
tomek320's user avatar
0 votes
2 answers
84 views

Determine which cannons on a ship can hit a target [closed]

I have a ship that will shoot targets, but cannons on the right side should never try to shot at targets on the left side of the ship. Thus I have created sectors using the ...
Mad Hatter's user avatar
1 vote
1 answer
323 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 ...
Xscreade's user avatar
0 votes
0 answers
621 views

Using a Raycast to stop the player from going through walls

I've been having this problem in the last couple of hours and I was just thinking if someone could help me figure it out, since I am unfortunately not a programmer, or at least a good one at all. I'm ...
mikeadam's user avatar
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 ...
Clyeh's user avatar
  • 13
0 votes
0 answers
300 views

How to shoot raycast, and display image on canvas

I have been trying to work on raycast, where if a raycast hits an object then an image will be displayed on the canvas, like on COD Warzone if I go to an elevator shaft, and look at the wire to go up, ...
Artificial Engineer's user avatar
1 vote
0 answers
382 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–...
Dolfje's user avatar
  • 11
1 vote
0 answers
59 views

Floorcasting not scrolling in raycaster?

I'm currently working on a raycaster in Java, and so far, I have the floor correctly textured. The problem, however, is that the floor doesn't scroll. In other words, when I move the camera in the ...
Joshua Crotts's user avatar
0 votes
1 answer
4k 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 ...
Object's user avatar
  • 289
0 votes
0 answers
58 views

Help with particles and raycasting

I have a 3D side scroller style game in which the player flies along avoiding stuff, you know, side-scrollery things. I'd like to add an effect (particle system) to the player when they get close (say ...
Twisted's user avatar
1 vote
1 answer
106 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 ...
Андрей Тарасков's user avatar
1 vote
1 answer
788 views

Trying to get sprite from isometric "z as y" tilemap

I'm using code like the following with a tilemap and tilemap collider 2d: var ray = Physics2D.RaycastAll(worldCoordinate, Vector2.zero); Unfortunately, when I ...
Alexander Trauzzi's user avatar
1 vote
1 answer
99 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 ...
Netherwire's user avatar
0 votes
1 answer
1k views

Can't add script behaviour Interactable. The script class can't be abstract!

I'm building a Raycast setup where game objects run code on click / touch. ...
Matthew's user avatar
0 votes
1 answer
254 views

Constructing a world ray from mouse coordinates

I've got the following c++ code. It produces a Ray from the mouse coordinates given. However the z coordinate is wrong, I expect it to be on the near plane of the ...
Śaeun acreáť's user avatar
1 vote
0 answers
298 views

How can transparency be implemented in a Minecraft-like game without sorting the vertices?

I'm working on a minecraft clone with OpenGL and I've been trying to implement the rendering of textures with transparency for several days now with out succes. What techniques can be used to achieve ...
TheBaum's user avatar
  • 43

1
2 3 4 5
10