0
votes
1answer
91 views

How to find objects in front of my player

I am trying to find an object that is in front of my player sprite using the following code RaycastHit2D hit = Physics2D.Raycast(transform.position,Vector2.right,EnemyLayer); //EnemyLayer is the ...
0
votes
1answer
233 views

Platformer raycast collision detection

I'm using Unity to create a 2D platformer. For collision detection, I'm using raycasting to detect any possible collisions with specific collision layers, and adjusting the desired delta x & y ...
2
votes
3answers
157 views

Strategy for detecting hits from a “cylinder ray”?

I was planning on using ray casting for collision detection in my game. However, when I use an attack similar to this: (which would project something like a cylinder), how would I go about ...
0
votes
3answers
132 views

Keeping raycast on the same level

I want my raycast to end at certain height(red line). But as the game is 3D and the camera rotates I can't use a fixed magnitude. What I thought was a stroke of genius, I figured I'd project the ...
6
votes
1answer
2k views

Why doesn't Unity's OnCollisionEnter give me surface normals, and what's the most reliable way to get them?

Unity's on collision event gives you a Collision object that gives you some information about the collision that happened (including a list of ContactPoints with hit normals). But what you don't get ...
4
votes
1answer
1k views

Finding if a point is inside of a mesh (Point-in-polyhedron)

How can I find if a point (Vector3) is inside of a mesh? Would this work for both concave and convex objects? I read somewhere that if you raycast in both directions of every axis (X, -X, Y, -Y, Z, ...
3
votes
2answers
2k views

Raycasting in Unity3D?

I have a game object on screen represented by a cube (but say it was a quad or something else all the same). How do I raycast to check intersections? Keeping in mind I may not be raycasting fora ...