Questions tagged [raycasting]

A rendering technique to create a 3D perspective in a 2D map

1193 questions
4
votes
1 answer

Java Game Engine: Raycasted walls are hollow, broken, and look like fecal matter

I am attempting to write a raycasting engine. I studied the tutorial found at http://www.instructables.com/id/Making-a-Basic-3D-Engine-in-Java/ and the C++ raycasting tutorials found at http://lodev.org/cgtutor/raycasting.html, and after a few…
xonerex
  • 79
  • 4
4
votes
0 answers

Raycasting inaccurately calculating intersections

I am trying to write a raycasting algorithm described in this article. I use a coordinate system where y increases upward, x increases to the left. The variable names in the following code snippet are taken from the article, I will describe them so…
mirgee
  • 390
  • 2
  • 13
4
votes
0 answers

Click On Mini Map Camera To Get Object On world Space

I am making a mini map Using render texture to render my Over head cam to my screen and Drawing that texture using NGUI 3.9 every things is fine Apart from When i am Trying to click on My minimap and trying to destroy a object or Geting the point on…
Syed Anwar Fahim
  • 306
  • 5
  • 15
4
votes
1 answer

Three.js invisible plane not working with raycaster.intersectObject

I am trying to make draggable objects, as seen in this example: https://www.script-tutorials.com/demos/467/index.html The objects which should be draggable are in the array objectMoverLines. I have added a plane to my scene with the following…
MrGarretto
  • 282
  • 4
  • 14
4
votes
1 answer

Wierd Raytracing Artifacts

I am trying to create a ray tracer using Qt, but I have some really weird artifacts going on. Before I implemented shading, I just had 4 spheres, 3 triangles and 2 bounded planes in my scene. They all showed up as expected and as the color expected…
Stephen B
  • 93
  • 5
4
votes
4 answers

Detecting an object with Raycast2D

I'm working on simple strategy game mechanics. I have a Barracks prefab. When I add the Barracks on the scene and click on the Barracks, I receive an NullReferenceException error: NullReferenceException: Object reference not set to an instance of…
Halil Cosgun
  • 427
  • 3
  • 10
  • 24
4
votes
2 answers

Three.js raycaster intersection

I wrote the code below to get intersection point with a 3d shape. It works well but if there are two intersection point with shape, it returns me only the farest intersection while I need the nearest intersection with the shape. How can I do to get…
Stefano Maglione
  • 3,946
  • 11
  • 49
  • 96
4
votes
2 answers

Precision problems in raycasting algorithm

I am programming a raycasting engine. The starting position of a ray is given by the position of the player who is standing inside a 2D-grid. When casting a ray into a direction, I have to determine the grids that the ray is intersecting. (The…
Marius Anderie
  • 23
  • 1
  • 2
  • 12
4
votes
1 answer

Simple general rayCasting in box2d Javascript example

I've been looking through various tutorials on rayCasting with Box2D, but I haven't seen any clear examples. I was hoping someone familiar with box2dweb would be able to give a clear example of how one would go about setting up a simple function…
Marcell
  • 43
  • 5
4
votes
2 answers

How To exclude helper objects from intersection check by raycaster in threejs?

I have a threejs scene with intersection checking on objects. I'm adding every scene object to the array which is then checked by the raycaster. var intersects = raycaster.intersectObjects( scene.children ); I then check the color of an object and…
sthag
  • 43
  • 1
  • 6
4
votes
1 answer

ray casting from mouse with opengl 2

I'm attempting to do ray casting on mouse click with the eventual goal of finding the collision point with a plane. However I'm unable to create the ray. The world is rendered using a frustum and another matrix I'm using as a camera, in the order of…
Lewis
  • 213
  • 2
  • 10
4
votes
1 answer

raytracing: problems with transformations

I am having trouble incorporating transformations. For whatever reasons, everything is not going as I think it should, but to be honest - all the transformations back and forth make me quite dizzy. As I have read everywhere (although explicit…
alex
  • 1,277
  • 3
  • 14
  • 30
4
votes
3 answers

Raycasting algorithm with GPS coordinates

I'm making a small application with Google maps that determines if an entered address is part of a predefined service region. The user enters an address, and a PHP script fetches the lat/long from the Geocoding API and applies raycasting with a…
John V
  • 269
  • 3
  • 15
3
votes
2 answers

C# Unity 3D - Is there a way to make custom raycast shapes?

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 SignedAngle function, this works fine for testing, but its also kind of…
Mad Hatter
  • 85
  • 9
3
votes
1 answer

Unity - move the starting position of raycast slightly forward along its direction

I am still new to coding in unity, so please be gentle XD ... I want to make a raycast that is hitting a collider to start a new raycast with the same direction but not starting from the point where it has hit, but just slightly forward along its…
ANB_Seth
  • 141
  • 2
  • 10