- Home /
instantiated GameObject Prefab jumps in air after instantiate
I'm instantiating a random car from the Resources folder and each car has a different body (different color) so I'm instantiating the body too and then set its' parent to be the cars' transform and set its position to be (0,1,0) but somehow from the middle of nowhere, the car jumps in the air! I tried to change the rigid body settings or the wheel colliders values but the same problem but I found out that when I set the body mesh collider Convex to true the problem disappears but then I got the following warning: Couldn't create a Convex Mesh from source mesh "Body" within the maximum polygons limit (256). The partial hull will be used. Consider simplifying your mesh. and I got a very strange car behavior anyone got an idea on how to fix this? Please view this link to see a video in my GitHub repo for better explanation github repo the photo is the code for Instantiate the car
Answer by b4guw1x · Mar 08, 2021 at 06:18 AM
Im not sure it willl work but did you try freeze y position when you instantiated a car? like
carRb.constraints = RigidbodyConstraints.FreezePositionY;
After you can simply free the constrains with
carRb.constraints = RigidbodyConstraints.none;
Your answer
Follow this Question
Related Questions
I need to move a clone of a prefab to a specific position after it instantiates 1 Answer
Help On Checking OverLaping in instantiating 0 Answers
Changes to prefab instance generated from script aren't remembered 1 Answer
Using Part of prefab as script parameter 1 Answer
How to instantiate prefabs with offset transform.position values? 2 Answers