MonstrousSoftware / MonstrousSoftware.github.io

Blog about game dev coding
Creative Commons Attribution Share Alike 4.0 International
0 stars 0 forks source link

2023/11/05/Tutorial-3D-step5 #2

Open utterances-bot opened 6 months ago

utterances-bot commented 6 months ago

3D Tutorial - Step 5 - Physics and collisions | Coding Adventures

by Monstrous Software

https://monstroussoftware.github.io/2023/11/05/Tutorial-3D-step5.html

gatlanit commented 6 months ago

How would one learn to add physics and collisions with Bullet if they wanted to? Would it be a similar process as the one described in this tutorial?

MonstrousSoftware commented 6 months ago

Doing this with Bullet instead of ODE4j is remarkably similar, but less portable between different platforms because you're interfacing with a C library from Java. Bullet comes with its own debug drawer, so we don't have to create modelInstances to see the collisions shapes. There is an excellent tutorial by JamesTKhan here on using Bullet with LibGDX: https://www.youtube.com/watch?v=DVKfHfxPKPM

LatinRhythms commented 4 months ago

when I run the program the collisions form and I can see them get affected by gravity and other collisions. but the ball meshes don't fall down with it. any idea why? even after copy and pasting the code directly(for testing purposes). was there something in the game screen class I should've added?

LatinRhythms commented 4 months ago

I was able to fix it. I was missing syncToPhysics() in my update method.