Git Product home page Git Product logo

Comments (4)

DanielChappuis avatar DanielChappuis commented on July 17, 2024

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?

from reactphysics3d.

Devyre avatar Devyre commented on July 17, 2024

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:

_1
_2

Ever since then I've been wondering if there is any way to get that done in a performant manner.

from reactphysics3d.

DanielChappuis avatar DanielChappuis commented on July 17, 2024

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.

from reactphysics3d.

Devyre avatar Devyre commented on July 17, 2024

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.

from reactphysics3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.