Giter Site home page Giter Site logo

babylonjs-editcontrol's People

Contributors

pryme8 avatar ssatguru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

babylonjs-editcontrol's Issues

Scale bounds behaves erratically when min bound is set to zero

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.

Editor tools interfering with bounding box + re-sizing when camera moves

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.

  1. The size/scale of the editor tools themselves seems to change based on the position of my camera.
  2. My bounding box implementation (which i will leave the code for below) is being broken whenever the editor tools are active. It seems to react to the changes made by the tools but gets completely separated from the mesh itself. The scale tool ends up controlling its location so perhaps something is wrong there?

Here is a video showing the irregular behaviour:

editor-tool-bugs.mp4

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;

npm / webpack

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

editControl.setTransSnapValue doesn't work in sample-global

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;
   };

Trouble compiling from typescript

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.

Error when rotating while looking directly at axis

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()

scaling along plane not intuitive

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

Getting "Error: Eulerian is set to false but the mesh's rotationQuaternion is not set" on creation

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

parent/child issue

if mesh is a child of another mesh then editcontrol doe snot work as expected

handle mesh with non uniformed scaled parent

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.

Scale and Trans bounds

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?

ends remain white when switching mode

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

Update during transform

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.

  1. Add an "updateOnMove" flag - when set, the control calls the action listener on every move
  2. Add a new type of listener - to distinguish from the current action
  3. Add new action types - eg: ActionType.TRANS_MOVE, .ROT_MOVE, SCALE_MOVE

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

How can I get the scaling values?

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?

Adjust scale "speed"

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.