- Home /
Other
Object gets stretched out when parented to terrain
Hello! I am making arrows stick into the ground when the hit the ground
But when i parent the arrows to the ground. They stretch out. I have no clue why
Answer by antx · May 04, 2017 at 10:53 PM
Is your terrain scaled nonuniformly (1, 1, 2 or something like that) ?
If so then reapply the scaling to the arrows after parenting them.
void class Arrow : MonoBehaviour
{
private Vector3 defaultScale;
void Start()
{
defaultScale = transform.localScale;
}
public void ParentArrow(Transform terainTransform)
{
transform.SetParent(terainTransform);
transform.localScale = defaultScale;
}
}
If your Terrain has a completely different scaling than your arrows, like way bigger or smaller, then you might need to multiply your defaultScale accordingly. (do this already in Start() where you get this value, for a little speed).
In your modeling program next time Never scale your models on just one or two axis when modeling them or you always get this problem. if you need to scale, actually select and move or scale points and Verticies.
antx's answer works for a fix. or you can usually drop the model into a secondard parent and parent that parent. this seems to be a problem with only the first parent in the hierarchy.
Follow this Question
Related Questions
My characters can't sto falling terrain 1 Answer
Raycast problem trough the terrain 1 Answer
Camera Problem 0 Answers
How to create a ground/terrain/floor that won't respond to gravity or objects falling on it? 1 Answer
Collision Help 1 Answer