Closed CrazyWords1 closed 3 months ago
The model does not want to accept setScale normally.
Applying setScale()
to a compound shape is tricky, because it's not obvious how scaling should affect the child shapes. If possible, generate the collision shape at physics-space scale to begin with.
The center of mass at the corner
The center of mass is at (0,0,0) in the shape's coordinate system. You choose where to position the child shapes relative to that center.
Have you read the tutorial page that discusses collision shapes? In particular, the section on shapes for dynamic bodies? If you're unsure how to calculate the center of mass, principal axes, and moments of inertia for your entity by hand, you may want to use the principalAxes()
and correctAxes()
methods mentioned in the tutorial page.
the model does not want to converge with the visual representation
The open-source Minie and SPORT projects provide debug visualization tools for solving these sorts of issues. Perhaps you can adapt them for your Minecraft environment.
Thank you so much, I figured out how to set the center of mass, I really appreciate your help. now I'm trying to figure out why the minecraft model doesn't visually match the physical model.
With SPORT I was able to fix the visualization of the model, and I still have one last question, how i can mirror (flip) the CompoundCollisionShape on one of the axes?
P.S ( I mean the rotation of the model itself, not the PhysicsBody )
That looks like a rendering question, not a Libbulletjme question. Mathematically, mirroring on, say, the X axis replaces (x, y, z) with (-x, y, z). In the context of 3-D graphics, reflection might also require reversing the winding order of the polygons.
That looks like a rendering question, not a Libbulletjme question. Mathematically, mirroring on, say, the X axis replaces (x, y, z) with (-x, y, z). In the context of 3-D graphics, reflection might also require reversing the winding order of the polygons.
I really appreciate your help, thank you, you answered all my questions
Based on the previous issue, I wrote a simple code to turn a json model from Minecraft into a CompoundCollisionShape using boxes.
But I encountered three oddities,
P.S(I think I made a mistake in model conversion function, but I don't realize what I made wrong)
populateSpace
Test model - christmas-hat.json![изображение](https://github.com/stephengold/Libbulletjme/assets/32343185/5ab8e8ce-9446-4f53-93e6-83e0ed86d3b9)
If you can at least give me a hint as to what I'm doing wrong, I'd really appreciate it!