bberak / react-native-game-engine-handbook

A React Native app showcasing some examples using react-native-game-engine 🐒✨
MIT License
598 stars 85 forks source link

Boxes on Physics Rigid Bodies Demo not rotating #19

Closed joshua-hew closed 3 years ago

joshua-hew commented 3 years ago

The Boxes on the Rigid Bodies Demo are not rotating. Oddly, the physics / the Matter.Bodies seems to be correct and when you stack one box on the ledge of another so that more than half of it is hanging off, it will fall and rotate, but the box's visuals do not match the "invisible" 2d rigid body.

I pulled this repo and ran on iPhone 11 pro - iOS 14.

bberak commented 3 years ago

Thanks for the heads-up @CSugarPrince - I think others might be experiencing the same issue. This demo was initially written on a much older version of React and has not been updated since. I suspect that the Box renderer's are not updating due to a shallow prop comparison.. I'll try get this fixed soon - I might even update the renderers to use functional React components rather than classes - since that seems to be becoming the standard method of writing components.

joshua-hew commented 3 years ago

Hey, thanks for the quick reply! Also I forked your repo and made a quick fix that uses Animated.View from react-native-reanimated to solve the issue.

Do you mind if I make a pull request so that you can take a look?

bberak commented 3 years ago

Oh that would be great @CSugarPrince, please do!

Cheers!

joshua-hew commented 3 years ago

Sorry for getting back to you so late. Just submitted pull request #20 for my fix. I tested on IPhone 11 pro simulator and on my physical device using expo. Didn't check to see if fix affected other parts of the handbook apart from the rigid bodies demo (though I don't think it should).

Anyways, take a look when you can and see if everything works for you!

bberak commented 3 years ago

Awesome @CSugarPrince - I’ll check it out tomorrow and get it merged asap. Cheers!

bberak commented 3 years ago

Addressed in PR #20 - much appreciated!