A technique for using rays to determine points of intersection. Often used in lighting simulation.
-1
votes
0answers
21 views
Using ray casting to access a function associated with an opengl mesh [duplicate]
I am doing a 3d scene in C++ using OpenGL for my project in graphics programming. I want to be able to point the camera at things and use them such as drawers light switches and chairs etc. I am ...
0
votes
0answers
16 views
Simplifying grid based intersection checking to not need 16 checks from each corner
I'm working on an "underground prisons and fire breathing lizards" inspired CRPG.
So far I have implemented a "path drawing" method to, well, show the grid cells that would be involved if one were to ...
0
votes
0answers
69 views
How can I improve my ray casting algorithm
So I finished coding this ray casting algorithm in C++ and I feel like it could be improve, despite that, I believe that it is really good since it is coded using SFML.
Here is the algorithm in C++
...
1
vote
1answer
47 views
Ray casting fails when it shouldn't
I have two objects that should collide. My player should stand on a ship. The position where my player stands, is exactly on the edge of two adjacent triangles (in the ship's model). To Check for ...
0
votes
1answer
44 views
Raycast from ScreenCenter hits object but does not return its tag
Here is my code:
using UnityEngine;
using System.Collections;
public class Crosshair : MonoBehaviour {
public Camera cam;
RaycastHit hit;
Quaternion rot;
// Update is called once per ...
0
votes
0answers
52 views
Find which object is clicked on 3d scene
I am using GamePlay3D engine. I have on scene a couple of 3d objects and I want to make them clickable.
How to find when I click which Node/Object contains given projection point?
I tried with code ...
1
vote
1answer
44 views
Raycast a ray to the tip of another ray
I'm using unity to raycast a line from the center of my camera viewport to a world position (yellow line).
I also want to cast a ray from the center of my character to this same point (blue line).
I ...
0
votes
0answers
26 views
Drawing Ray from ray picking is not working correctly
I have been implementing ray picking to select squares in my opengl program. I tried to follow this post I found http://gamedev.stackexchange.com/questions/109579/algorithm-for-triangle-picking
after ...
1
vote
0answers
28 views
How to generate mesh at runtime using raycast points?
I'm trying to make a clone of the trail/line renderer with the difference that everything is perfectly flat, i.e. the faces are not designed to face the camera. I'm using two raycasts to get the ...
0
votes
1answer
64 views
2d raycast collision problem
I am currently making a 2d top down game in unity and have stumbled upon a problem with my raycast collision. I want my green player to stop moving when colliding with a wall, therefore i made my ...
0
votes
1answer
85 views
Raycasting. Corner trap
In my top-down game character moves to target (pathfinding) also avoiding obstacles with Raycasting(Central ray with whiskers), but situation like on picture causes shiver and unneeded turning ...
0
votes
1answer
49 views
How to find a material through a raycast in Unity 5?
I have an empty object with a script on it and I want to be able to move the empty over other objects and then have it print out the name of the material for the triangle that it's hovering above. ...
0
votes
0answers
18 views
Finding intersection in CPU ray casting
I'm trying to implement a ray casting on CPU, for each pixel I have a ray. I'm reading the data which is stored in a rectilinear grid. I'm trying to find the intersection but I'm not sure how to do ...
0
votes
0answers
50 views
Simulate a touch on a point where ray hits in Unity
I want to simulate a touch input on the position where a ray hits an object, and only if it hits something.
I know that it's not common to do it with a raycast, but I need it this way for the HTC ...
0
votes
0answers
23 views
Raise an object off from the surface of another object set by raycasts
I have a basic FPS and I just added in bullet holes. The way it works is when the mouse is clicked, a method is called in the animator that fires a raycast from the nozzle of the gun outwards, and ...
1
vote
0answers
86 views
OpenGL RayCasting and Intersection with plane
I have been trying for a couple of days to raycast. I have a Renderable/Texture/Primitive/Whatever placed in the WORLD at 0.0f,0.0f,0.0f, and when I click the mouse I want to know at what X,Y ...
1
vote
2answers
58 views
Wall checking not working correctly
Basically I am working on side scrolling 2d game. For that I want to check whether player is collided with wall. I have written some code for it but can't able to decide where I have done stupid ...
2
votes
2answers
104 views
How do you avoid lag with Three.js and mousemove?
I'm trying to create a browser moba-like game using three.js. I'm using WASD for movement and the player rotation follows the mouse with mousemove then lookAt() the intersection.
The problem:
As I ...
2
votes
0answers
32 views
Combining Two Sets of JavaScript
So I am fairly new to programming and I am trying to learn by making a simple game. I watched to different videos on ray cast shooting and one of them has code for bullet hole decals that I wanted to ...
2
votes
1answer
47 views
Find out hit child with RaycastHit
Let's assume having a (2d-) gameobject with 3 images: Head, body, feet.
By using RaycastHit2D I can find out if the gameobject was hit (for example by the mouse):
RaycastHit2D newSelectedObject = ...
1
vote
1answer
131 views
Raymarching on a Hi-Z buffer in GLSL
So I'm trying to implement Screen Space Reflections using a Hierarchical z-Buffer in GLSL. I'm following the approach from GPU Gems 5 and the Frostbite presentation linked here ("Stochastic ...
4
votes
3answers
139 views
How to test for adjacency?
I need to come up with a better way to test for adjacency in a grid environment. Imagine that the blue is water, the green is land, and the red dot is a character. What I need to do is efficiently ...
1
vote
0answers
60 views
How to make dynamic DOF from mouse position in Unity 5?
I found a video a while ago for how to make a dynamic DOF in unity. It fires rays from the camera and positions an empty at the location that the ray first hit. How can I change this so that it ...
1
vote
1answer
55 views
2DRaycast is shooting slightly in wrong directions
I wanted just a simple 2DRaycast, which points from my character to my mousePointer. So I found the following code in the Internet, most people seem to use it like that. So I tried it, but it isn't ...
1
vote
1answer
134 views
Why is Raycast hitting masked layer?
Many questions have been posted on this topic but I'm facing a weird behavior which I could not find an explaination for.
I perform a raycast giving it a LayerMask parameter which is defined as ...
1
vote
1answer
115 views
Ray & Segment Intersection
I'm writing some code to check intersection between all of a rectangles segments and a ray. It will sometimes use the Left and Right side of the rectangle as the closest face hit (face DA & BC) ...
1
vote
3answers
277 views
Unity C# - Raycasts, How to Ignore Triggers?
Let's say I have a Raycast, but I don't want it to collide with any triggers. I don't want to change the Project settings since that's a little inflexible.
How can I have a Raycast ignore any ...
0
votes
0answers
91 views
Use xbox right analogue stick for ScreenPointToRay
I have done a tutorial where the player rotation is controlled with raycasting which follows the mouse pointer. I have been trying to change it to follow the right analogue stick on a xbox controller. ...
2
votes
1answer
100 views
Continuous Collision Detection
So I'm playing around with the separating axis theorem and collision. Obviously the problem of what face it collided with arose. I need the unit normal which is tangent to that face it collided with ...
1
vote
2answers
274 views
Unity - Raycast not hitting to BoxCollider2D objects
I'm working on 2D and I have a Quad as background.
And some wall sprites over this quad :
I'm instantiating wall prefab sprites over quad when user click to somewhere. But I don't want to ...
0
votes
1answer
218 views
Click to move - get NavMesh layer
I'm using NavMesh, and NavMeshAgent for my character movement and Pathfinding.
I made a testing NavMesh with 2 area layers:
0 = Walkable
3 = Water.
In have a click to move script, and i need to ...
0
votes
1answer
14 views
characterController reference issue
I am trying to move my character to point that taken from mouse position.
here is my code:
private Vector3 hittedPoint=Vector3.zero;
if (Input.GetMouseButtonDown (0)) {
Ray ray = ...
0
votes
1answer
77 views
Getting ray using gluUnProject or inverted MVP matrix
I've read a lot of topics here, on SO, opengl.org etc.
Example how gluUnProject should work (from NeHe tutorial):
winX = (float)x;
winY = (float)viewport[3] - (float)y;
glReadPixels( x, int(winY), 1, ...
1
vote
2answers
69 views
Cursor position to a 3D ray using angles
I've been stuck for a month trying to get gluUnProject working. After my attempts to use gluUnProject failed (as well as attempts to implement gluUnProject functionality manually) I implemented method ...
1
vote
2answers
55 views
Shading a 2D visibility mesh to act like a light?
I have a visibility mesh made by raycasting:
https://my.mixtape.moe/omjlgr.webm
Right now, I'm using a shader to color the mesh white and fall off with distance and radius (the texCoord in this case ...
1
vote
1answer
279 views
Is it possible in Unity to Flip a 2D Sprite Without Flipping the Object it is Assigned to?
I 'built' (followed a tutorial) on a collision detection system, and when I flip the object to go left and right the collision messes up. So I have three options; find a way to modify the collision ...
-1
votes
1answer
42 views
Simple voxel-block melee removing script
I'm trying to create a voxel based game, now I want my character to remove blocks with a melee weapon, but I'm not sure which way to go.
I mean is it the only way to get the Block with a raycast? I ...
0
votes
2answers
176 views
Raypicking / raytracing in OpenGL
Alright, so before you down vote saying that OpenGL doesn't support rays for rendering, please read:
So I want to detect a quad in opengl 1.1( I don't want to use opengl 3.0). I wanted to detect it ...
0
votes
0answers
55 views
Unreal engine: How to get FHitResult.FaceIndex?
When I do
PlayerController->GetHitResultUnderCursor(ECollisionChannel::ECC_WorldDynamic, false, TraceResult);
TraceResult.FaceIndex is always -1.
Here @OriCohen says that I have to "use a ...
1
vote
0answers
124 views
Unreal Engine 4 Line Trace Error
This is the error that I am currently facing:
PlayerPawn.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl APlayerPawn::Trace(struct FHitResult,class AActor *,struct FVector ...
2
votes
3answers
113 views
Unity - Check if object is facing Vector3 coordinates
I am having a hard time figuring this out, I want to have objects that move around randomly, and when they get new coordinates to move towards, face them, and then move.
Here's explained:
Target ...
0
votes
0answers
18 views
Problem with cameracliping unity
Hello GameDev Community,
i've got a small problem with figuring out a way to do cameracliping
in the unityengine with raycasting i got two main problems the first being that my
camera flicks ...
1
vote
1answer
44 views
Collision resolution moving Point to AABB with raycasting
This is probably trivial, but I'm having trouble making it work.
I have a 3-coordinate world of particles simulated with Verlet Velocity. I only care for collision between their centers and a few ...
0
votes
0answers
134 views
How do you set up the physics for a tank?
My goal is to make some tank like vehicle since there is not a suitable one in unity5 store yet.
First I tried wheel collider, could not get it to work.
I tried to use raycasting and fixed joint, ...
1
vote
1answer
66 views
How can I determine “exact moment” of collision with ray casting?
I'm currently brainstorming how the physics for my game engine is going to be handled.
It's top down and I'm thinking of using ray casting for collision detection.
I've reached two potential problems ...
1
vote
1answer
72 views
How to resolve collisions when using ray-casting to predict the location of future collisions?
I ran into a question I can't seem to solve, while implementing the movement/ collision checking code for my game. The game is in 2D and all objects in my game use either AABBs or circles as collision ...
0
votes
1answer
199 views
OpenTK Ray Picking
I just can't get ray picking to work (I need to drop old working faedback mode, and replace it with color pick, but because my scene can have up to 300K+ objects it is reasonable to filter (it's a ...
1
vote
0answers
93 views
Issues with 2D raycasting lighting under limitations of HLSL 3.0 pixel shader
I've been writing my own HLSL pixel shader for dynamic lighting using raycasting. Unfortunately, since I'm using this out of XNA, I can only use up to ps_3_0. As you can see, the limitations ...
2
votes
1answer
166 views
How to Reciprocally draw on a 3D mesh and 2D UI Image in Unity?
My question is a bit involved so I'm going to split it into parts and attach a picture.
1) In Unity I'd like to be able to draw a line on a 3D worldspace mesh with the mouse.
2) As I'm drawing on ...
0
votes
1answer
86 views
Would Raycast suffice for a game clock based on sun position?
I need help with some logic in my script. I created a dynamic day/night cycle that works fine in itself, but I want to add a game clock that works off the initial position of the sun (Directional ...