Hello
So im simply shooting arrows and when it’s hitting a collider it’s rigidbody is set to kinematic and it’s parent is the Colliders transform.
But The arrows glitch out dramatlicly and it’s scale changes somewhat random and is flatten out on the ground. Note it also spams the log with i quote:
“BoxColliders does not support negative scale or size, The effective box size has been forced positive and is likley to give unexpected collision geometry”
Why is it changing the scale of the arrow? I know the boxcollider is scaled with the arrow so that explains the error but why does the arrow object scale like crazy just from these two lines of code:
void OnTriggerEnter(Collider col)
{
GetComponent<Rigidbody> ().isKinematic = true;
transform.parent = col.transform;
}
Thanks
~Flux
[EDIT]
Thanks to @Harinezumi i learned that transform.parent is not longer used and that SetParent is a better way of doing it. Altough setting the worldpos to true did not work for me so i set it to false.
Thanks @Harinezumi
Thank you for clarifying that. But the problem stays the same.. Any idea?
– fluxhacksproIn my case, I have to supply
– simpleyujifalseintransform.SetParent(col.transform, false)to make it not have its scale changed to a very large number. Setting it totrueas per the recommended answer didnt work (probably a typo?)