Skip to content
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

ArcCamera setting upVector crash #250

Closed
DenysAshikhin opened this issue Oct 26, 2022 · 3 comments
Closed

ArcCamera setting upVector crash #250

DenysAshikhin opened this issue Oct 26, 2022 · 3 comments

Comments

@DenysAshikhin
Copy link

Hi all,

I am trying to change the orientation of the arc camera rotation, which I know works on babylonJS sandbox, but when trying to implement it in react-babylonjs I get the following stack:

 math.vector.ts:2102 Uncaught TypeError: Cannot read properties of undefined (reading 'm')
    at Vector3.TransformCoordinatesFromFloatsToRef (math.vector.ts:2102:1)
    at Vector3.TransformCoordinatesToRef (math.vector.ts:2088:1)
    at ArcRotateCamera._getViewMatrix (arcRotateCamera.ts:1136:1)
    at ArcRotateCamera.getViewMatrix (camera.ts:817:1)
    at Scene.updateTransformMatrix (scene.ts:3484:1)
    at Scene._renderForCamera (scene.ts:3563:1)
    at Scene._processSubCameras (scene.ts:3654:1)
    at Scene.render (scene.ts:3918:1)
    at Engine.tsx:141:1
    at Array.forEach (<anonymous>)

Sample arcCamera:

 <arcRotateCamera
                  name="camera1"
                  target={
                    factoryDimensions.x !== 0
                      ? new Vector3(
                          factoryDimensions.width / 2,
                          -factoryDimensions.depth / 2,
                          factoryDimensions.height / 2  
                        )
                      : Vector3.Zero()
                  }
                  position={new Vector3(0, 0, 10)}
                  alpha={(6 * Math.PI) / 4}
                   beta={(7 * Math.PI) / 4}
                  upVector={new Vector3(0, 0, 1)} //ISSUE HERE
                  radius={
                    factoryDimensions.x !== 0 ? factoryDimensions.xMax : 75
                  }
                  upperRadiusLimit={
                    factoryDimensions.x !== 0 ? factoryDimensions.xMax * 2 : 75
                  }
                  lowerRadiusLimit={
                    factoryDimensions.x !== 0 ? factoryDimensions.xMax / 15 : 10
                  }
                  wheelDeltaPercentage={0.01}
                  wheelPrecision={2}
                  panningSensibility={200}
                  noRotationConstraint={true}
                  collisionRadius={new Vector3(0.1, 0.1, 0.1)}
                  upperAlphaLimit={3600 * Math.PI}
                  lowerAlphaLimit={-3600 * Math.PI}
                  upperBetaLimit={3600 * Math.PI}
                  lowerBetaLimit={-3600 * Math.PI}
        />
@brianzinn
Copy link
Owner

hi @DenysAshikhin I will deploy a fix for this once I get a chance to test. I think it's already on main branch for a month actually as it was an issue brought up in babylon.js forum...

@brianzinn
Copy link
Owner

@DenysAshikhin can you confirm it's fixed in 3.1.13?

@DenysAshikhin
Copy link
Author

Yup it's fixed in 3.1.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants