Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. RaycastHit hit;
  2. Ray ray = new Ray(thisTransform.position + Vector3.up, Vector3.down);
  3. if (Physics.Raycast(ray, out hit, 10f))
  4. {
  5. float offset = thisTransform.position.y - hit.point.y;
  6. thisTransform.position = new Vector3(thisTransform.position.x, thisTransform.position.y - offset, thisTransform.position.z);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement