A technique for using rays to determine points of intersection. Often used in lighting simulation.

learn more… | top users | synonyms (1)

0
votes
1answer
22 views

Unity: OnTriggerEnter2D does not get called when using Raycast

In a previous post I talked about creating wires (using Bézier curve) using LineRenderer. I am using a PolygonCollider2D to wrap the wire (see below): GameObject wire = new GameObject (); ...
3
votes
1answer
54 views

Unity: What type of Collider should I add to a LineRenderer?

I am currently building a game where I need to generate some wires (as Bézier curves) using LineRenderer. After changing the width of each line lineRenderer.SetWidth (0.15f, 0.15f); I am attaching ...
0
votes
1answer
35 views

Raycast not working on touchscreen (Android tablet/phone)

I have a raycast that works in the unity editor but not when I build it for Android( tablet or phone, neither work). The code I'm using is as follows: public class DirectionalTilePlacing : ...
0
votes
1answer
29 views

Raycasting against my plane does not detect collisions in Unity

I'm trying to keep the camera above a plane which acts as the ground, so I wrote this bit of code: RaycastHit hit; if (!Physics.Raycast (transform.position, new Vector3 (0, -50, 0), out hit, 5)) { ...
8
votes
3answers
865 views

How to handle RTS Click-And-Move in 3D Space?

How can I handle the click-and-move in a complete 3D space? It is easy to handle on a 2D plane by a simple raycast, but this is not the case in 3D since there is no end-plane for a raycast to get an ...
2
votes
0answers
42 views

SFML Raycasting Problem: Textures not displaying propely

I have been lurking on gamedev.Stackexchange for a while now and finally have a question to ask. I have been working on a simple raycasting engine (like wolfenstein 3d) using the SFML Graphical ...
1
vote
0answers
26 views

Retreive 3d World Map coordinates from touch/click input with LIBGDX?

Problem: I am trying to create an RTS style interaction. I want to be able to click on the map and have characters move to the click location. I haven't been able to figure this out, even after ...
0
votes
1answer
27 views

Raycast will not hit generated box colliders at initialization

In my map class I have an algorithm that is generating and merging box colliders together. These belong to the layer "Ground". After that, in some places on my map I'm generating some new cubes on-...
1
vote
1answer
30 views

How to Ignore Raycast for Boxcollider2D by layer or boolean?

how can I ignore Raycasting for specific object,perhaps you say use Queries Hit Trigger but when I use it Ignore all Raycasting for triggers but I want filter Ignore Raycasting for some objects I need ...
2
votes
0answers
38 views

Unity raycast misses convex mesh collider

I have a bunch of fighter AIs that are doing attack runs on a target (Currently just a cylinder). It is designed to veer off course the moment it gets too close and loop around for another attack ...
0
votes
0answers
40 views

Floor casting in a Raycasting engine

I'm trying to create a pseudo 3D, raycasting engine with plain JavaScript rendered on the HTML5 canvas. In short: a Wolfenstein 3D clone. So far I have gained inspiration from the following guides: ...
0
votes
1answer
56 views

Project camera-to-pixel ray in world coordinates

I'm trying to implement a very simple ray tracing function but I have a problem with projecting the camera ray (from camera to pixel) to the world space. In the screen coordinates have the pixel ...
1
vote
1answer
71 views

How to get color or value from material with shader?

I have a sphere with a shader with colors for specific heights and I want to get the value at the cursor(height) or color of the point the cursor is on when clicked. Is there a good way to get this ...
0
votes
2answers
38 views

Script no longer working now that it is attached to a child object. Why is this?

So I decided I wanted to make this script part of a separate swap-able weapon so I made a child and put the script there. Before the script worked fine but now it won't work. The script works as ...
1
vote
1answer
77 views

Checking if point is inside the mesh via raycasting - where to cast rays?

I need to voxelize triangle meshes which involves testing if a point is located inside or outside the given mesh. I have just implemented a basic algo based on raycasting and checking the number of ...
0
votes
1answer
85 views

Covert Minimap render texture to 3d space position

I am using Render texture to make a Mini Map it is working fine but now I want to go further on side map and want world space position from render texture click point. Is there any way available that ...
0
votes
1answer
37 views

How to refer to a object that has just been hit by a ray cast?

I would like to use RigidbodyConstraints.FreezeRotation;in order to freeze the rotation of an object that is picked up. The problem is I don't know how to refer (or call) the currently selected object....
0
votes
2answers
61 views

How to address raycast failures due to tiny holes in a mesh?

Problem: I have a racing circuit that is made out of tiles, each of which is made out of 2 triangles. I need to know over which tile my craft is hovering on; but since there are tiny holes between ...
1
vote
1answer
94 views

Pixel Picking vs Raycasting

I was recently introduced to a way of picking in OpenGL known as pixel picking (or color picking). From my understanding, how this is done is that the scene is rendered to the back buffer with a ...
0
votes
1answer
33 views

Limit Quaternion/vector3 axe in a certain interval

I have some trouble to understand, and handle Quaternion and Vector3. I'm improving the tutorial Tank of Unity: EDIT: Because a video explain so much better, there is a link to the 30 secondes video ...
0
votes
0answers
60 views

Unity 3d sendmessage to another script, with parameter of raycastHit?

I am trying to send message from 1 script to another, and need to do something like that: var hit : RaycastHit; .... if(soemthing){ checker.SendMessage("MakeEffect", hit); } and another script: ...
1
vote
2answers
53 views

Unity3D - Determining if a spherical object is grounded using raycast

I'm making a game revolving around moving a ball around a space. My game has a jump mechanic, so I need to know when I'm grounded in order to determine when I'm able to jump. Best way to check this is ...
0
votes
0answers
28 views

How to convert Non-Axis Aligned Bounding Boxes to AABB

I'm trying to write a raytracer to render boxes (cubes) that are arbitrarily rotated, i.e. not necessarily axis aligned. While I'm reasonably comfortable ray-tracing an axis-aligned cube, I don't know ...
3
votes
2answers
172 views

Need help with a field of view-like collision detector!

I ran into a trouble while making a field of view for my character. I figured how to make it work with a Linecast, but what I really need is a cone-shaped field, so that the character can detect ...
0
votes
2answers
124 views

How can I prevent 2D teleportation from teleporting through solid objects?

In my 2D game, the player is able to teleport to any place on the screen with the click of the mouse button. What I am trying to prevent is the ability to teleport across solid objects. If the point ...
0
votes
0answers
21 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
86 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++ ...
2
votes
1answer
88 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
85 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
57 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
54 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
27 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
56 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
144 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
137 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
241 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
19 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
111 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
31 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
133 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
65 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 ...
3
votes
2answers
248 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 ...
1
vote
0answers
34 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
99 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
284 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 Screen-...
4
votes
3answers
171 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
89 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 doesn'...
1
vote
1answer
69 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
617 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
189 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) ...