2022 Developer Survey is open! Take survey.

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
31 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 ...
user avatar
1 vote
1 answer
35 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 ...
user avatar
0 votes
1 answer
86 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 ...
user avatar
1 vote
1 answer
51 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 ...
user avatar
0 votes
1 answer
43 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. ...
user avatar
0 votes
0 answers
12 views

Raycasting fisheye effect [duplicate]

I am making a raycasting engine and I have an issue. There's this fisheye distortion happening. I tried the cosine solution, but that produces this circular effect: Here's the code I have (yes I ...
user avatar
0 votes
0 answers
112 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 ...
user avatar
1 vote
0 answers
45 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 ...
user avatar
  • 43
0 votes
1 answer
14 views

Raycaster Textures Scrolling?

I am making a raycaster, I Have currently got textures rendering, but with North and South faces it appears that the texture is scrolling infinitely. I have read Shimmering, scrolling/panning a ...
user avatar
0 votes
1 answer
23 views

Converting mesh vertices to world coordinates for raycasting

My goal is to figure out if a point exists within a 3D polygon. To do this here is what I am doing: Load obj mesh ...
user avatar
  • 101
0 votes
0 answers
33 views

Physics2D.CircleCast works strange

I'm creating a 2D game and spawn my enemies with Collider 2D and Rigidbody2D, and my hero is attacking them, but he casts his ...
user avatar
0 votes
0 answers
29 views

Can't hit collider when rotating while go along with wall

as you can see in the picture, my character go along with wall. it detected wall by capsulecast. (the direction of capsulecasting is forward of character) when it go straight, capsulecast hit the wall ...
user avatar
  • 105
0 votes
1 answer
40 views

Unity how to make raycaster test only against collider in frustum

I'm working on a scene with thousands of object wich have all a collider associated. I'm just testing if my mouse is on top of any collider in a 2D space. The raycasting operation is taking a lot of ...
user avatar
0 votes
0 answers
80 views

How to display ray collision object with Ray Perception Sensor 3D Unity ML-Agents

I try to detect collisions with the Ray Perception Sensor 3D from Unity ML-Agents. I read that collisions with colliders through the rays will be automatically added to observations. How can I display ...
user avatar
0 votes
0 answers
31 views

Gun keeps firing before the player is finished rotating

I have a script that manages player rotation and shooting. When I click on an enemy, the player is supposed to turn toward the enemy and then shoot in the direction they are facing. However, the ...
user avatar
1 vote
1 answer
74 views

How can I improve collision padding against level geometry in my 2D game?

I'm scripting my own collision logic for a 2D game that works like this: Boxcast in the direction of movement against appropriate colliders in the scene If a ...
user avatar
1 vote
1 answer
25 views

How to snap a point to the height of the navmesh surface?

I'm making generator for EQS and need to put points on navmeshes located on different heights, one above other. So, my idea is to make raycast vertically and find intersection points with navmeshes. ...
user avatar
  • 231
1 vote
2 answers
71 views

Placing player hand on wall, only works with right-angled walls

...
user avatar
4 votes
0 answers
89 views

How inefficient is my ray-box-intersection algorithm?

One of the most critical parts of my raytracer is the calculation of a collision between ray-box which is done following way: ...
user avatar
  • 41
0 votes
0 answers
22 views

Aim assist-- How to cast a wedge in screen space

My character exists in a 3D, isometric, top-down world. I'd like to make an aim assist mechanic, such that when holding the right joystick in a direction the game will choose the enemy roughly in that ...
user avatar
  • 143
1 vote
0 answers
31 views

Is treating object meshes as nav meshes a sensible strategy for grounding characters?

It bothers me that a lot of character controllers are written to rely on raycasting for movement along the ground. While this solution is very straightforward and general (especially in the sphere ...
user avatar
0 votes
1 answer
274 views

Unity 2D - Raycast not colliding with collider in very specific circumstances [duplicate]

I've been trying to work out what could be causing this bug for days now but can't figure it out for the life of me. I'm trying to make a fish avoid the walls of it's tank in a Unity game I'm creating ...
user avatar
0 votes
1 answer
272 views

Raycasting in GameMaker Studio 2 to implement hitscan weapons?

I'm working on a 2D top-down shooter game in GameMaker Studio 2, featuring different weapons and obstacles all around the levels. Since I don't need a high degree of simulation, I'm implementing ...
user avatar
  • 3,914
0 votes
1 answer
91 views

Automatically create capsule colliders from bones?

I have tried to automatically generate capsule colliders from bones by temporarily creating a mesh collider and using raycast to find the distance to it from the bone, but when I create the capsule ...
user avatar
  • 135
1 vote
1 answer
81 views

Player rotation recalculation causes jittering on edges

When my player walks around a circular planet everything works well, but when my planet is a shape like a cube or a dodecahedron, even with smoothed edges, my character jitters if I walk slowly on the ...
user avatar
1 vote
1 answer
54 views

Can I cache and edit Unity RaycastCommands?

I'm simulating a LiDAR and am working to optimize the code. In following along with the RaycastCommand documentation, I have the core functionality working and I'm trying to optimize it. I see where ...
user avatar
  • 249
0 votes
1 answer
75 views

Teleport character a fixed distance in the direction it is looking

Game : bird's eye view (2D) When I touch the button, my character will teleport a fixed distance in the direction it is facing. If there is an object at that distance (like a wall) it will not ...
user avatar
  • 13
1 vote
0 answers
71 views

how to raycast against a mesh instead of the object in unity

So I am trying to make random map generation for a game, and right now I am trying to use a raycast to get the height of the spot where a prefab will be generated, I am using a terrain and generating ...
user avatar
1 vote
0 answers
93 views

Raycasting floor texture distortion problem

I'm currently working on a raycaster in construct 2. The FOV is 90 degrees with a screen resolution of 199 x 174. I used this tutorial when it comes to the floor raycasting. The floors seem to render ...
user avatar
  • 11
0 votes
1 answer
102 views

“undefined reference to” error when compiling for MinGW

I tried to move to MinGW to compile my program, since I am trying to use a more recent OpenMP version than the 2.0 one used in Visual Studio. I was planning on using ...
user avatar
3 votes
1 answer
606 views

How to raycast down to the floor plane to determine world space coordinates in Godot

I've been trying to find a solution to this task and despite finding answers to similar issues, they were always somewhat overcomplicated (e.g. finding a position on a texture) or the problem was ...
user avatar
0 votes
1 answer
71 views

How can I offset a raycast a certain distance from the camera no matter which way it is facing?

I am raycasting from the camera, which allows me to get the object that the player is looking at within a certain range. The issue I have is that the camera can be zoomed out away from the player, so ...
user avatar
0 votes
1 answer
743 views

What is the logic behind of ScreenPointToRay?

I'm confused about ScreenPointToRay Definition of this method says "Returns a ray from camera through a screen point". I'm trying to visualize it to understand how it works. But its not ...
user avatar
2 votes
2 answers
89 views

Need help with fixing Optimized Raycasting / Line of Sight algorithm

I'm trying to implement collision detection with raycasting for my 2D javascript game. The game uses equally-sized tiles as its level structure so to optimize collision detecton I'm trying to use a ...
user avatar
0 votes
1 answer
52 views

Having issues with 3rd-person Camera Raycasting / Local<->World Space / Clipping

I would like my camera to inherit the player in the hierarchy, and get closer when there is a wall or floor between the player and the camera. Right now I am trying to raycast from the player to the ...
user avatar
0 votes
0 answers
135 views

How to detect ray cast collision on terrain gameobjects?

I made a script were an objects shoots a ray cast facing on the vertical axis and detects were the terrain is and then moves to the current terrain height wherever it is. This is so I can spawn an ...
user avatar
  • 155
0 votes
1 answer
27 views

How to find if a Ray intersects a Triangle Clockwise or Counter Clockwise

I have a Triangle with an intersecting Ray. How can I find out if the triangle's vertices are in a clockwise or counter clockwise rotation order with respect to the Ray?
user avatar
  • 101
0 votes
1 answer
46 views

Simulating Road Traffic/Overtaking - Overtake works mostly, but starts clipping other vehicle

I am trying to improve on my Car class, which is used to make a small road scene with 3 lanes each direction with the ability to overtake by changing lanes. I had a very basic version working with all ...
user avatar
0 votes
0 answers
106 views

How to calculate ray unit grid intersections?

P is ray origin, D direction. How do I calculate tx, ty(s)? This is for octree raycast. The primary goal is to get 1st intersection voxel (v) then second (v") and so on.
user avatar
1 vote
1 answer
337 views

Getting the point of intersection from this fast ray box intersection algorithm

I have seen lots of such algorithms that return a Boolean value, but I also need to get back the intersection point and ray length. I am looking into this example, but I'm not sure how I can extract ...
user avatar
  • 161
0 votes
0 answers
85 views

How to raycast octree for closest leaf node?

So I need to raycast a octree for closest leaf node as efficient as possible. I will be doing it on compute shader (hlsl), but I think it doesn't matter because first I need to understand the approach ...
user avatar
0 votes
0 answers
134 views

What is causing my wheel collider's raycast to fail?

I'm making custom car suspension(Custom wheelcollider etc), now I encountered a problem where if car gets dropped from a certain height, raycast will fail to detect collision and wheels intersect with ...
user avatar
  • 541
0 votes
0 answers
27 views

Rotating with a preferred direction [duplicate]

I do a RayCast to the terrain and then use the RaycastHit.normal to plant flags. I would like to have the flags to point up with the normal, but have them all face the same direction. As seen in the ...
user avatar
0 votes
0 answers
77 views

Pinch Gesture for Function Other than Zooming- Unity

I'm working on a game in which I want to pinch outwards on a character, which causes the character to split into 2 smaller copies of itself. The method I'm thinking about using is to have the "...
user avatar
  • 1
0 votes
1 answer
598 views

How to perform a fast ray cylinder intersection test? [duplicate]

I need an algorithm in c++ to get the intersection point of a line if there is an intersection. My cylinder is defined by a 3d vector center point, a float height and radius. I don't need to take ...
user avatar
  • 5
0 votes
3 answers
250 views

Voxel raycasting algorithm not working correctly

I am using Unity with a compute shader to render to a texture. So far I have been checking points along the rays in units of 1 just for testing, so I know it works. Now I am simply trying to write a ...
user avatar
0 votes
1 answer
100 views

Experiencing strange behavior in Unity when rotating a 2D GameObject according to the slope it is standing on

I am trying to rotate a square GameObject, so it appears to be standing perpendicular to the slope underneath it. However, when above a slope, the square constantly "spins"; it seems like ...
user avatar
0 votes
1 answer
219 views

Select specific tile in Tilemap

I am following this video tutorial on how to implement drag-to-select behavior like in an RTS. The only difference is, I'm using a tilemap. The selection area is a square which I can drag to make it ...
user avatar
0 votes
1 answer
42 views

Dialogue System only plays the same words

I'm trying to modify brackeys dialogue system using raycast in an interactableOjects Script so that I can talk with multiple characters, however, when I talk to Character A it appears Characters B ...
user avatar
0 votes
0 answers
90 views

Godot raycast colliding too high

I am making an fps that uses a raycast for shooting. I used some suggestions taken from a few reddit pages, but it's mostly my own code. It was working properly, until I noticed that when you shot up ...
user avatar

1
2 3 4 5
9