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

How to set dimensions of primitives? #94

Open
partynikko opened this issue Oct 2, 2018 · 2 comments
Open

How to set dimensions of primitives? #94

partynikko opened this issue Oct 2, 2018 · 2 comments

Comments

@partynikko
Copy link

Hi,

I have searched everywhere in the source code but I cannot find any place where to set dimensions of primitives? For example if I want to create a cube that's 1x2x1.

I tried using scale instead: cube.scale.set(1, 2, 1) but that doesn't update the bounding box.

Any suggestions or is it a lacking feature?

Thanks
Best regards

@pissang
Copy link
Owner

pissang commented Oct 19, 2018

Sorry for the late reply. You can set the width/height/depth properties when creating cube geometry.

const cube = new clay.geometry.Cube({ width: 1, height: 2, depth: 1});

More commonly we will set scale like in your code. And bounding box can be applied with the scale transform.

cube.scale.set(1, 2, 1);
cube.updateTransform();
cube.geometry.boundingBox.clone().applyTransform(cube.localTransform);

@partynikko
Copy link
Author

Thanks a lot, will definitely try it out!

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