ssatguru / babylonjs-editcontrol Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Works well for rotation and scaling, but not for translation.
Scale bounds works fine in all cases except that if the min vector of any of the scale axes is set to exactly 0, the object will flicker between 0 and some random small size as the mouse moves. It looks as if the diff values being sent to doScaling() are bouncing around. This only happens if the min vectors values are set to exactly 0. Any other arbitrarily small number works fine.
due to bounding box based scaling when all three axis are chosen together scaling does not happen uniformly
in right hand coordinate system the axes are reversed
Hey there. I'm not sure if this library is still being supported but thought I'd log an issue just in case. Not sure if this is due to my implementation or not but I'm noticing two issues that are leaving me scratching my head.
Here is a video showing the irregular behaviour:
Here is my bounding box code (its pretty much ripped straight from the docs):
let childMeshes = parent.getChildMeshes();
let min = childMeshes[0].getBoundingInfo().boundingBox.minimumWorld;
let max = childMeshes[0].getBoundingInfo().boundingBox.maximumWorld;
for(let i=0; i<childMeshes.length; i++){
let meshMin = childMeshes[i].getBoundingInfo().boundingBox.minimumWorld;
let meshMax = childMeshes[i].getBoundingInfo().boundingBox.maximumWorld;
min = BABYLON.Vector3.Minimize(min, meshMin);
max = BABYLON.Vector3.Maximize(max, meshMax);
}
parent.setBoundingInfo(new BABYLON.BoundingInfo(min, max));
parent.showBoundingBox = true;
when returnEuler (true) is executed transform along local axes stops working
Hi,
I'm looking at using the EditControl for a project that is built with webpack, which means we can't import the dependencies in a script tag.
Is there an easy way to package this up as an npm package? Or some other way I can cleanly export it for import?
Thanks
I'm trying to enable snapping by giving editControl.setTransSnapValue a value but nothing happens.
I've just put it in the index.js at the transButton, but when I click it, nothing happens ( still no snapping)
transButton.onclick = function () {
editControl.enableTranslation();
editControl.setTransSnap = true;
editControl.setTransSnapValue = 10;
};
I created my own fork (to try to help figure out the npm stuff), but can't get the typescript to compile.
npm install works, but when I run npm run compile I get a ton of "Cannot find namespace 'BABYLON'." errors.
select a large mesh then switch to a small mesh. try scaling. mouse has to be moved large distance to scale
My project starts with the camera looking directly at the object. If you try to rotate the x by dragging on the red ring (which is essentially a straight line from this angle), you get a "Cannot read property 'x' of null' error on this line:
var diff = newPos.subtract(this.prevPos);
if (diff.x == 0 && diff.y == 0 && diff.z == 0)
in onPointerMove()
depending on which co-ordinate axes quadrant the camera is in, the scaling along plane behaves differently
In some quadrant moving the pointer towards camera scales up whereas in others it scales down
the behavior should be the same in all quadrants
Hi,
I'm getting the error "Error: Eulerian is set to false but the mesh's rotationQuaternion is not set." when I instantiate the editControl with the useEuler set to false (or null):
this.editControl = new EditControl(this.scene.meshes[0],this.camera, this.canvas, 1, false);
If I set it to true, the control works except when rotated with snaps on, in which case I get "Cannot read property 'toEulerAngels' of null" in doRotation() (around line 680).
This only seems to happen when I use webpack to build everything. I can't reproduce it in the playground.
Any thoughts?
James
At my Playground my TwoAxisDraggingButtons (I just called it this way, hope you know what I mean) are triangles, but using your sample-global I got rectangles which I prefere, how do I change this? And how many designs are there available?
if mesh is a child of another mesh then editcontrol doe snot work as expected
We have an issue when the mesh has a parent and the parent scaling is not uniform, that is the scaling in x y and z are not the same.
In such cases the axes are no longer at right angle to each other.
To handle this we would have to change how axes are drawn
For now if the scaling of parent is not uniform we prevent any transforms.
with 3.0.0 + release translation and scaling in "all/any" directions works erratically.
click the yellow guide to freely move or scale mesh.
the way the movement /scaling takes place is not consistent.
There's one more addition to the API that I'd need to make this work in my current project which is to add something like a setScaleBounds() and setTransBounds() methods that take a BABYLON.BoundingBox and limit how far you can scale and translate to that box. (I suppose you could do the same with rotationBounds, but it will be harder to specify the limits.)
@ssatguru Is this something you'd like to do or should I give it a shot?
to reproduce
go to a mode say translate
hover over an axis say x
axis x will become white
without moving cursor switch to rotate
switch back to trans
the x axis arrow remain white
Currently the actionListener is only called on pointer up. It would be very helpful to have it get called while the user was actively manipulating the control (so we can show the user how much they've moved/rotated/scaled the object, for example). It's important that the API distinguish between the two types of actions.
I can see three ways to handle this.
My vote would be option 3 because it clearly distinguishes between the types of action and doesn't add the confusion of different types of listeners. We could also think of adding a ActionType.TRANS_START, .ROT_START and .SCALE_START incase people want to do something else while the user is manipulating the control (like open up a 'stats' window).
Once we decide on an option, I'm happy to add this myself (once I figure out the compiling issue).
Thanks,
James
the control doesnot behave correctly when attached to a right hand mesh in a left hand scene and vice versa
Sorry if I missed it, I noticed you can use getPosition and getRotationQuaternion to get the position and rotation information, but how can I get the scaling ones?
What I want is to know the changed values in registered action listeners, since the only argument for the listener is the action type, so I have to get the values by other functions, am I right?
Is it possible to adjust the scale "speed"? That is, change how much a mesh scales given the size of the mouse move? I think this has to do with the scale of the objects in my project, but right now, a tiny move makes the scale shoot out to the horizon.
Thanks,
James
Today it is hard to select the translate or scale plane guides when the camera is not facing the mesh from front. The plane guides should be positioned based on camera position. Kind of similar to rotation guides
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.