Questions tagged [raycasting]

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

1193 questions
-1
votes
3 answers

How do i add the objects that the raycast is hitting in unity and add them to a list

I have this problem that i just can't figure out how to solve. I am trying to make a game in Unity, and i have stumbled across a problem that goes like this. I want to put an object in the scene in a list, when i hit it with a raycast. With what i…
-1
votes
1 answer

Raycasting render 2d chest CT scans to 3d using OPENGL/C++

I am going to split this question in 3 parts First, I've been given this problem, and I don't know where to start, if you have been solving related problem, would you give me some hints and keywords to help me do some more research? I have done some…
Ade
  • 11
  • 1
  • 4
-1
votes
1 answer

a seemingly simple RaycastALL unity problem I can't figure out

I'm in the middle of a game jam and I've been looking for 3 hours why my RaycastALL doesn't detect every collision. Here's the bit of code that handles this. Thank you very much for your time. I'm available to answer all your questions regarding my…
-1
votes
1 answer

Use of unassigned local variable (CS0165) Raycasting in unity

I have this piece of script that I made and I get this error and I don't understand why RaycastHit HitFL, HitFR, HitBL, HitBR; grounded = CastRayFrontLeft(out HitFL) || CastRayFrontRight(out HitFR) || CastRayBackLeft(out HitBL) ||…
-1
votes
1 answer

How do you make raycasts that shoot at the player in C#?

I have been trying to do an fps game and got stuck at the part where the enemies can shoot the player, and I'm not quite sure what I can do. The enemy keeps on roaming instead of actually attacking the player. Even worse, they sometimes walk away…
Zapter
  • 9
  • 4
-1
votes
1 answer

Intersection of a ray with a segment in 3d

Ray and segment of polygon lie in the same plane. The normal vector of this plane is known. I need to know if a ray intersects this segment
user14205063
-1
votes
1 answer

Raycast target not moving with parent even though rays function with a vector direction

Object facing left at the center of the scene, with the raycast cast with ray of transform.position, transform.forward Object facing left at the edge of the scene with the same ray, ray still casts to the same point even though the point is being…
-1
votes
1 answer

My raycast is not activating my enemies death in Unity 3D

I've been trying to make my enemy fall when it's health reaches zero. So I made a damage variable. The damage will subtract to the health and when it reaches zero or lower, he's supposed to turn into a ragdoll. But its seems as he's not dying in the…
-1
votes
2 answers

Unity raycast not detecting an object which has already been detected by it before

using UnityEngine; public class Shoot: MonoBehaviour { public Camera cam; void Update() { if (Input.GetButtonDown("Fire1")) { shooot(); } } void shooot() { RaycastHit hit; if (Physics.Raycast(cam.transform.position,…
CODER_SCREAM
  • 63
  • 1
  • 1
  • 8
-1
votes
1 answer

Unity3d Physics.Raycast not working ('Physics' does not contain a defenition for 'Raycast')

So this is my code; void Update() { RaycastHit hit; if(Physics.Raycast(transform.position, Vector3.down, 100, out hit)) { //Do something } } And it is not working. When I do this it will say; 'Physics' does not contain a…
-1
votes
3 answers

How to rotate a line around one of its vertexes

I am making my first raycasting engine, and would like to rotate a line over an angle θ How does one do this? Would it be possible to show me some basic C++ code or some pseudocode? This image describes my problem: Optional question I decided to…
user9430539
-1
votes
1 answer

Multiple raycast on enemy ai

I have a cone shape with 3 raycasts, but the enemy only detect the player if the player is in either one of the 3 lines, i wanted to add more raycast to the enemy. I have ask around, some said to add more raycast with for loop, but im not familiar…
Gallant
  • 1
  • 1
-1
votes
2 answers

Large scale raycasting and counting hits

Firstly, I'm new to WebGL, OpenGL programming in general. I think that these tools will allow me to solve a problem, but I don't really know where to start. My problem: Given a single origin, a target (triangle or mesh) and a list of many…
-1
votes
1 answer

Trying to get the script of another class in unity with javascript

My Raycast is working and hitting my Enemy. But if I hit him, I want to change the health variable in the other script of the hit Object (Enemy Controller) by calling the TakeDamage(damage) function. Unfortunately, I get this…
1zz0
  • 264
  • 3
  • 18
-1
votes
3 answers

Unity - Shooting at your crosshair even if there is no ray hit?

I am creating a first person shooter script. In order to get the bullet to travel straight at the cross-hair, I calculate the ray hit and shoot the bullet in that direction. The problem is if there is nothing within the range, it won't shoot at all,…
Kyle Jensen
  • 419
  • 9
  • 27