Dad72 Posted September 27, 2018 Share Posted September 27, 2018 Hi @trevordev, I found, I think, a bug to recover the change of position / rotation / scaling with the observable DragStart and DragEnd which retrieves the same position value for example. If I start with DragStart, I should recover the position of an object at the start, that's OK, but when we move and release (DragEnd) the position of the object should have changed, but it is the same as with DragStart and yet the object was moved on the stage, but not in the recoverable value in the observable. A PG is better than a long explanation: (move the X axis (red) and look at the values in the console. the x position is the same as dragStart and dradEnd) https://www.babylonjs-playground.com/#4TBMBR#8 PS: Using e.dragPlanePoint.x it gets the X position of the gizmo pointer and not the pivot object select (maybe we could get the object selected) I find it very repetitive to use an observable for each axis. This gives : This would be shorter : gizmoManager.gizmos.positionGizmo.Gizmo.dragBehavior.onDragStartObservable.add((e)=>{ console.log(e); }); gizmoManager.gizmos.positionGizmo.Gizmo.dragBehavior.onDragEndObservable.add((e)=>{ console.log(e); }); than that : gizmoManager.gizmos.positionGizmo.xGizmo.dragBehavior.onDragStartObservable.add((e)=>{ console.log(e); }); gizmoManager.gizmos.positionGizmo.yGizmo.dragBehavior.onDragStartObservable.add((e)=>{ console.log(e); }); gizmoManager.gizmos.positionGizmo.zGizmo.dragBehavior.onDragStartObservable.add((e)=>{ console.log(e); }); gizmoManager.gizmos.positionGizmo.xGizmo.dragBehavior.onDragEndObservable.add((e)=>{ console.log(e); }); gizmoManager.gizmos.positionGizmo.yGizmo.dragBehavior.onDragEndObservable.add((e)=>{ console.log(e); }); gizmoManager.gizmos.positionGizmo.zGizmo.dragBehavior.onDragEndObservable.add((e)=>{ console.log(e); }); Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 27, 2018 Share Posted September 27, 2018 The values in the playground that are pushed to the array are objects so position will be pointing to the same x,y,z values. You should clone the positions when you store them to get a copy. See https://www.babylonjs-playground.com/#4TBMBR#10 As for unifying the sub gizmo events to parents I created this PR (https://github.com/BabylonJS/Babylon.js/pull/5268) which adds dragstart/end to position/rotation/scale gizmos. Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 27, 2018 Author Share Posted September 27, 2018 Thank you Trevor. And for the use of dragStar and end on the position, rotation / scale. What changes? gizmoManager.gizmos.positionGizmo.zGizmo.dragBehavior.onDragEndObservable.add() should we do like this? gizmoManager.gizmos.positionGizmo.dragBehavior.onDragEndObservable.add() Or gizmoManager.gizmos.positionGizmo.onDragEndObservable.add() Quote Link to comment Share on other sites More sharing options...
trevordev Posted September 27, 2018 Share Posted September 27, 2018 It will be to this gizmoManager.gizmos.positionGizmo.onDragEndObservable.add() Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 27, 2018 Author Share Posted September 27, 2018 OK, that's very good. thank you very much trevordev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.