Art Vandelay Posted January 22, 2018 Share Posted January 22, 2018 Hi, In the drag and drop demo in the playground, if I change position.addInPlace to absolutePosition.addInPlace it stops working. Can anyone explain what is happening here (thus also clarifying the difference between position and absolute position). Thanks! Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 22, 2018 Share Posted January 22, 2018 The position is the object's position in its own coordinate system. If you simply place an object in a scene, it's position and absolute position will technically be the same. The problem starts when you add a parent to the object. If the parent's x is 1, and the object's x is 0, it's position's x will be 0, but absolute position will be 1. You cannot change the absolute position. It is a read-only vector (you can Set it, but not change it). that's why it doesn't work in the drag & drop example. Quote Link to comment Share on other sites More sharing options...
Gijs Posted January 22, 2018 Share Posted January 22, 2018 In addition to what @RaananW said, you can see how it's done in the code: Line 206 Line 267 Line 276 https://github.com/BabylonJS/Babylon.js/blob/4480b79c5ea42961566adf5eb1f591c0c79a7596/src/Mesh/babylon.transformNode.ts So you can use setAbsolutePosition() instead Quote Link to comment Share on other sites More sharing options...
Art Vandelay Posted January 22, 2018 Author Share Posted January 22, 2018 Thanks guys, that's just what I needed to know 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.