- Home /
Question by
Saladon · Dec 24, 2014 at 01:47 PM ·
physics.raycast
Physics.Raycast If/Else Problem
Good day,
I'm having a problem with bringing an object from my object pool using Physics.Raycast if/else. It seems to visually jump back and forth with the frame rate. Is there a smoother way of achieving this?
if (Physics.Raycast (ray, out hit, Mathf.Infinity)) {
if(hit.collider.gameObject.name == "GridPlane") {
Vector3 gridPosition = hit.collider.gameObject.transform.position;
hoverGrid.transform.position = new Vector3(gridPosition.x,gridPosition.y+0.1f,gridPosition.z);
} else {
hoverGrid.transform.position = objPool.transform.position;
}
}
Comment
Your answer

Follow this Question
Related Questions
Physics.Raycast lagging behind 1 Answer
Shoot on spheres 0 Answers
event triggered by the wrong camera 0 Answers
execution order of Destroy and Physisc.Raycast 1 Answer
Physics.Raycast not detecting objects between camera and player 2 Answers