Questions tagged [raycasting]
A technique for using rays to determine points of intersection. Often used in lighting simulation.
448
questions
1
vote
1
answer
25
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
2
answers
86
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.
1
vote
1
answer
118
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:
...
0
votes
0
answers
16
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:
...
0
votes
0
answers
22
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 ...
1
vote
0
answers
37
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 ...
1
vote
0
answers
42
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 ...
1
vote
1
answer
166
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, ...
0
votes
1
answer
32
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
2
answers
57
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 ...
0
votes
0
answers
405
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&...
0
votes
1
answer
97
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
0
answers
76
views
How is it possible to display the crosshairs and the spaceship correctly in a 3rd person space shooter game?
I am working on a 3D space shooter game. It has a 3rd person camera, so the spaceship is always visible. I am wondering about how the aiming can be solved, since the camera is not directly behind the ...
0
votes
1
answer
163
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 ...
0
votes
1
answer
200
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
0
answers
81
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 ...
0
votes
1
answer
169
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
48
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 ...
0
votes
1
answer
508
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 ...
0
votes
1
answer
235
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 ...
1
vote
3
answers
569
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:
...
0
votes
1
answer
321
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 ...
2
votes
1
answer
144
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 ...
1
vote
0
answers
208
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 ...
0
votes
0
answers
150
views
Why is the player being pushed backwards when shooting bullets?
I am trying to get a player to be able to shoot bullets, but it causes the player to push backwards and the bullets don't correctly work. The bullets shoot, but then the bullets will only disappear ...
0
votes
1
answer
186
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
52
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&...
0
votes
1
answer
169
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
0
answers
44
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 ...
0
votes
1
answer
1k
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'...
0
votes
2
answers
81
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 ...
1
vote
1
answer
275
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 ...
0
votes
0
answers
535
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 ...
1
vote
2
answers
848
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
...
0
votes
0
answers
272
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, ...
1
vote
0
answers
281
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–...
1
vote
0
answers
54
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 ...
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 ...
0
votes
0
answers
51
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 ...
1
vote
1
answer
86
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
728
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 ...
1
vote
1
answer
82
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 ...
0
votes
1
answer
924
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.
...
0
votes
1
answer
213
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 ...
1
vote
0
answers
229
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 ...
0
votes
1
answer
90
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 ...
0
votes
1
answer
97
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
...
0
votes
0
answers
182
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 ...
0
votes
0
answers
88
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 ...
0
votes
1
answer
226
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 ...