- Home /
How to scale a collider still conforming to PhysX?
I wanted to ask if it is even possible to scale a gameObject with collider so it stay's in sync with PhysX. I have a sphere that I want to scale up. It's lying on the floor. I tried scaling the object in both Update and FixedUpdate, but none of both ways made the collider stay on top of the surface. It's just sinking in and eventually getting out again. Running that at a fraction of time I can see that the iteration solver is doing its work, slowly.
Maybe I'm looking at this the wrong way. Maybe I have to move the object away from any collider surrounding it myself, but I wanted to be sure.
(The green sphere is the one scaled up. Notice how it penetrates the floor, even though it's scaled in FixedUpdate).
Answer by Loui_Studios · Jan 31, 2017 at 12:37 PM
You could try reducing the fixed time step, but that would increase the physics load.
Might I suggest a simpler solution?
Translate the object on the axis you're scaling -so that the object's collider never actually clips through objects in the first place.
It would have the same effect.
Otherwise, you need to find out the exact time in milliseconds that it takes for PhysX to correct the object, and then use that as your delay between scaling.
Thanks for the tips. I was thinking about moving while scaling and from what you're saying it also sounds like the best solution. cranking time steps sounds dumb considering only one gameobject scaling every now and then. Your last suggestion involves waiting during the scale, am I correct? I think that gives a visual stutter and might be slow.
I think I try a combination of final size spherecast and moving.
Thanks anyway :)
Yes my last solution would have a short delay in it.
There is one final option that you may consider.
You could scale the sphere with the point that is touching the ground being the pivot. It wouldn't work well if you planned on rotating it, but the pivot point would never move while the object is being scaled, so the bottom of the sphere would always stay at one point, while the rest of the sphere is scaled.
Thanks for accepting my answer. Comment if you need any more help! :)
Your answer
Follow this Question
Related Questions
Mesh Collider from 3d max animation? 1 Answer
Warning: BoxColliders does not support negative scale or size 4 Answers
Boxcollider is much bigger than the actual Object (imported from Blender) 2 Answers
Can I catch "Gu::ConvexMesh::loadConvexHull: convex hull init failed!" error? 2 Answers
Excluding some physics collisions 3 Answers