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

Disable negative rotation on the Y axis, is it possible to set via options? #66

Open
StefanThumann opened this issue Mar 27, 2023 · 2 comments
Labels
✋ Suggestion Suggest new things 🙌 help wanted Want to contribute to @egjs/view3d? Start with this issue!

Comments

@StefanThumann
Copy link

I need to use the following options for my plugin:

disablePitch: true,

minY: 0,

maxY: 90

Background is that I want to disable negative rotation on the Y-Axis for the model.

Is it possible to place these options inside the plugin init code like this?

plugins: [new View3D.RotateControl({
    
disablePitch: true,
    
minY: 0,
    
maxY: 90,

})]
@WoodNeck WoodNeck added ✋ Suggestion Suggest new things 🙌 help wanted Want to contribute to @egjs/view3d? Start with this issue! labels Apr 19, 2023
@WoodNeck
Copy link
Member

Hello @StefanThumann
View3D doesn't provide pitchRange yet, but I think we should provide it.

@StefanThumann
Copy link
Author

I have a working solution for this now. I place this piece of code after the plugin init code and it disables the negative rotation on the x axis.


// Wait for the model to load before calling updatePitch


view3D.on("load", () => {
    
  const camera = view3D.camera;
    
  const onRender = () => {

  if (camera.pitch < 0) {
            
    camera.pitch = 0;
        
  }

    
};
    

view3D.on("beforeRender", onRender);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✋ Suggestion Suggest new things 🙌 help wanted Want to contribute to @egjs/view3d? Start with this issue!
Projects
None yet
Development

No branches or pull requests

2 participants