- Home /
Question by
smirlianos · Oct 27, 2013 at 10:54 AM ·
instantiateraycastdecal
Instantiated hole double-planes with object
Hello,
I use this script to Instantiate a plane with a hole texture on objects, but it is Instantiated on the very edge of the object. As a result, it double-planes.
How can I Instantiated 0.01 units farther from the object?
var hit : RaycastHit;
if (Physics.Raycast (transform.position, fwd, hit, attributes.Range))
{
print ("We hit something!");
var InstPos : Vector3 = new Vector3(hit.point.x -0.1, hit.point.y, hit.point.z);
var instHole = Instantiate(Hole, InstPos, Quaternion.FromToRotation(transform.up, hit.normal));
instHole.transform.up = hit.normal;
}
Comment
Answer by robertbu · Oct 27, 2013 at 05:16 PM
I think you want:
var InstPos : Vector3 = hit.point + 0.01 * hit.normal;
Your answer
![](https://koobas.hobune.stream/wayback/20220613120715im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How i can repair my shoot decals? 2 Answers
Instantiating blood on walls using gameobject 1 Answer
Instantiate a prefab and parenting it? 1 Answer
Instantiate Objects on Cells created during run time 1 Answer
How to place blocks so they stick to a surface in any orientation? And stick to a grid? 1 Answer