vehicle/gameobject moving/listing/rotating when made parent of main character (child) game object
Very simple.
I created a main character
I make it a child of a vehicle game object using: Destroy (player.GetComponent ()); player.transform.SetParent(this.transform,true); player.transform.position = posicion_de_montar.transform.position;
As soon as I do that the vehicle begins strangely moving/listing and turning without any user input.
I trigger the parenting with an "OnTriggerEnter" on the vehicle.
I get my player game object with:
player = GameObject.FindGameObjectWithTag ("Player");
In case it makes any difference I'll mention that I did scale up the player game object, neither object has a position of 0,0,0, both have rotation 0,0,0, and the buttons in the top left corner are set to pivot and global.
I know I'm a super novice at this. Any help would be appreciated.
Thanks in advance.
Answer by tonythedea · Aug 27, 2016 at 08:58 PM
Well I figured out what that random "listing/drifting" was. I hadn't set Drag or Angular Drag to Infinity like in the tutorials, therefore when not in motion the object was either spinning or drifting.
Your answer
![](https://koobas.hobune.stream/wayback/20220612091700im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Error with parenting spawned weapon on client side 0 Answers
How to attach an object to another object so that moving one moves the other 0 Answers
bullet holes parenting 1 Answer
Why is transform.parent not working in Unity 5.5.4? 0 Answers
Canvas as a Child with Screen Overlay follows parent scale 0 Answers