-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rotation of boxes doesn't work #49
Comments
Hi @AlekseyKutsko, Could it be some additional styles that the Are there any warning messages in the console? In the renderer code, try the following change:
|
@bberak thanks for your reply! There aren't any messages in the console. Changing to I didn't work with expo earlier. I don't know, expo has some additional styles or not. I will try to find differences. |
Hi @bberak, I started empty expo project with command I downgraded react to 16.8.6 version, react-native to 0.60.6 version and the boxes began to rotate! Package.json
|
Nice debugging @AlekseyKutsko - really appreciate you taking the time to do that. I'm really baffled as to why the React and React Native versions break the rotation - but the handbook project is quite old now, so could use some maintenance (and your info will really help). Thanks again, and all the best with your project - let us know how you go! Cheers! |
Hi @bberak The problem with react-native 0.61.0 or above version. I started new project with react 16.9.0 and react-native 0.60.6 - the rotation works. But if I start a project with react-native 0.61.0, the rotation won't work. |
Cheers @AlekseyKutsko |
@bberak Please let me know if you know in which direction I can start looking in order to fix that. We need that for our project, so I am ready to help. |
Hi @AlekseyKutsko, Just checking in - could your issue be similar to: #56 (comment) Cheers. |
Hi @bberak. Hi @oleksiikiselov.
|
I made it work by using
|
I solved it by referring to @oleksiikiselov's solution. Thanks import React from 'react'
import Animated from 'react-native-reanimated'
const Box = props => {
const width = props.size[0]
const height = props.size[1]
const x = props.body.position.x - width / 2
const y = props.body.position.y - height / 2
const angle = props.body.angle
return (
<Animated.View
style={{
position: 'absolute',
left: x,
top: y,
width: width,
height: height,
transform: [{rotateZ: angle + 'rad'}],
backgroundColor: props.color || 'pink',
}}
/>
)
}
export {Box} |
Thanks for sharing @JeffGuKang. Is |
It is props value from the |
Thanks @JeffGuKang. How is |
@bberak I refered https://github.com/bberak/react-native-game-engine-handbook/blob/master/app/physics/rigid-bodies/index.js#L39-L41 I think MatterJS transform the renderer's component defined in entities. It just my opinion and I am not dig the MatterJS code yet. 😢 |
Hello! I start new project with command
npx react-native init AwesomeProject
. I inserted code fromreact-native-game-engine-handbook/app/physics/rigid-bodies/.
App work but boxes don't rotate. If I start with expo, boxes rotate. What is the problem?All code was copied from
react-native-game-engine-handbook/app/physics/rigid-bodies/.
I don't change nothingPackage.json
Video
Boxes.mov.zip
The text was updated successfully, but these errors were encountered: