- Home /
Raycast collision on camera see's only part of object
I am working on a game project and I want a GUI text "press E to pickup" when I look at a cube that's around the pickup. The cube has mesh renderer off and collision on trigger.
There is a Raycast script on the camera and when you look at the cube it show the text, but it's not showing it all the time. When I move my mouse down a bit the text disappears, same for left and right. It seems like it only detects the upper face.
This sucks because the flashlight is laying on the ground, and when I stand next to it and look down it doesn't work. When I move the box down so the upper face is just above the flashlight, even the upper face won't work..
Likely, your Raycast is either missing your cube, or it is hitting something in front of the cube. Use Debug.DrawRay() to create a visualization of the raycast, and use Debug.Log() to output the tag and/or the name of any object the Raycast hits. Folks on the list can be a lot more helpful if you post your script.
Your answer
Follow this Question
Related Questions
Camera raycast? 2 Answers
Tagged collision problem 1 Answer
Weird error with RayCasting (CS1502) 1 Answer
Can someone modify this for me? 0 Answers
Raycast doesn't collide as it should 1 Answer