Open Devyre opened 2 years ago
Hello. The physics bodies do not have a scale vector because scaling does not work well with physics simulation. However, you should be able to apply your scale before creating the collision shapes because I guess you also need to scale your 3D models for rendering right?
Note: Can I ask you to ask question in the Discussions section instead of creating a new issue?
Note: Can I ask you to ask question in the Discussions section instead of creating a new issue?
Yes, of course, my bad!
because I guess you also need to scale your 3D models for rendering right?
No, the rendered meshes remain at original scale. The technique they follow is basically to multiply the up axis by 0.65 and divide positions of objects by 0.65 (therefore putting them back to where they were).
However, you should be able to apply your scale before creating the collision shapes
I tried this once with PhysX in Unity. Since I was limited by the C# API of Unity, I ended up duplicating the scene, removing all meshes in that duplicated scene and only leaving (mesh)colliders, this duplicate object's root was then multiplied by 0.65 on the up axis and the original objects remained at their original scale but copied the position of the duplicated objects (and divided that by 0.65). Horrible approach of course. The problem that remained was, that only mesh colliders ended up working because box/sphere/etc were not adjusted by parent transforms. I think PhysX does that for performance reasons? Not entirely sure.
Here is an image that shows the collision difference:
Ever since then I've been wondering if there is any way to get that done in a performant manner.
I am not sure I really understand the goal of scaling the vertical axis.
When you say:
to allow an easier movement across slopes (of any dynamic rigidbody).
What does that mean exactly?
Anyway, in the library it is not possible to scale the bodies. If you want a bigger body along the up axis, you need to do scale it when you create the collision shape for that body. Note that for instance when you create a triangular mesh using the PhysicsCommon::createConcaveMeshShape()
method, you can pass a scaling factor in parameter at this point. Once the body is created you cannot scale it anymore.
What does that mean exactly?
On the images I posted, there is a slope next to the capsule. The first one is taller than the second, which makes the second one easier to traverse. What I try to achieve is that the first one is just as easy to traverse as the second one. Exactly the same. That's pretty much it. I found ways to do this but simple dynamic rigidbodies were always a problem.
Hey,
my question is a bit of an odd one. Is it possible to, for example, vertically scale all physics objects? I'm trying to recreate physics of a fairly old game and one of its techniques was to scale the physics to 0.65 on the up axis to allow an easier movement across slopes (of any dynamic rigidbody). This sounds a bit dumb but actually works quite well with everything.
If it's not possible, i'd appreciate any idea that could point me into the correct direction (that still helps me accomplish the above 1:1), sorry for this weird topic.
Greetings