Mouse Input for RayCast - Update or FixedUpdate
Should the check for Mouse Inputs that are going to start a RayCast be in Update or FixedUpdate. I ask as RayCasts are Physics and Physics should be done in `FixedUpdate` but the checks for Input are...
View ArticleRaycasts returns unexpected hit after a while
Heyho, So I have been working on an RTS like game where I select units with left click and order them to move using right click. However, I recently encountered an error in the raycast that causes the...
View ArticleHow to place a GameObject with mesh on a mesh "perfectly" through c# script?
**Summary:** I have a gameobject that have a rock mesh. However, the bottom of the mesh is hallow and ugly. I want to place it on a mesh that looks like a hill, so that the player cannot see the...
View ArticleDrag object smoothly In One direction And When Release Mouse Object snap to...
I want to move a gameObject drag with the mouse in X or Y axis. And when release the mouse I want it to snap to the nearby grid or int value. I am not good with calculating screen and world point. Hope...
View ArticleMoving Rigidbody up slopes/stairs
As the title suggest, I want to move the rigidbody up and down stairs. I've seen a couple cases where they suggest putting ramps on the stairs but this won't work as the player has their own gravity...
View ArticleFor raycast hits, what is a "barycentric coordinate"?
I haven't seen a good explanation for this yet. It's defined elsewhere as the "center of mass" for a triangle, pyramid, or for any dimensional "simplex". So in Unity, is it just the very center point...
View ArticlePhysics.IgnoreRaycastLayer putting GameObject on layer 4 water.
I'm trying to figure out how to make raycast ignore some of my GameObjects. I started reading the documentation and I noticed this page. [Physics.IgnoreRaycastLayer][1] When I checked it in the code it...
View ArticleWhy does Raycast not work here despite all but one layer recieving the ray?
Hello, i am a beginner to Unity and i am having a bit of trouble understanding Raycast's and Layermasks. I have a Physics.Raycast2D that uses a layer mask of anything but a "lever" and moves in a...
View ArticleBoxcast vs Raycast Oddities
Weird issue I'm having: I'm firing a **1 meter** large **boxcast** **DOWN** towards the ground. It starts **1 meter** off the ground and can at a maximum go down **1 meter**. (so, it should have a hit...
View ArticleTMPro UI elements not blocking raycasts
Hey everyone, I'm having a bit (**lot**) of trouble at the moment. I can't seem to make TMPro UI elements block raycasts and any normal UI elements for that matter. Even the...
View ArticleCylinder Ground Collision
I want to recreate how some games do ground collision, which has a **flat bottom** allowing stable and safe movement on the edge of objects. The height **will not lower** like a **capsule** or...
View ArticleQuestions about movement on uneven/slopped terrain and terrain coliders
Hi, I have a few questions related to the game I'm developing. https://postimg.cc/hJWppdpQ I have a vehicle that needs to move on a randomly generated terrain and handle slopes. I'm not using wheels,...
View ArticleHow instantiate only one prefab at different spawn place ?
Hello, Fristly sorry for my bad english :/ So I want instantiate one prefab for different spawn place but only 2 times. But spawn must run when I click on a specific model.![alt text][1] [1]:...
View ArticleUnity | Raycast Hit Empty Object which has Objects as Children
I Have an Empty Object with no collider which has children that are 'proper objects' with colliders and meshes etc... When I click on the Object and do: RaycastHit hit;...
View ArticleMouse clicking on an object (Raycast.hit) for another object to connect to it?
Hey guys, I am trying to figure out how to use a mouse on click event to "select" a face of a cube, then have another cube attach to it. I want to use raycast for this because I think it would be...
View ArticleRaycast not hitting right spot
I've got a problem with a game I started making. Basically every time I shoot, the particle effect which essentially shows where the raycast is hitting, isn't where my crosshair is pointing. My...
View ArticleReverse object position order
Hi! I have a small problem maybe more mathematical than unity, but it's still the right place I think. I'm trying to **reverse the object location order** detect by a raycast (this maybe not be the...
View ArticleUI element blocking OnMouseDrag()?
Hello beloved community, I am sorry if this problem turns out to be dumb but I have now been stuck with it for over 3 hours, so I hope you can help me. ---------- **My scene** By clicking on a UI Image...
View ArticleUnity3D - RTS Game - Instantiate object on buttonclick and make it follow the...
I am trying to instantiate an object of my "ObjectManager"-class by clicking on a button and then to make it follow my cursors position. Would like to know what I am doing wrong in this following code....
View ArticleRaycast not working with Character Controller
Hi, so my shooting hasn't been working. And the problem is with the Character Controller. As soon as I remove that from my player, the shooting works fine. I'm not really sure how to fix it. It's not...
View Article