Closed Amoki closed 4 years ago
I intentionally didn't implement the ability to transform (rotate/translate/scale) PerformanceNodes, so that PerformanceModel could have the smallest possible memory footprint.
If we were able to transform PerformanceNodes, then each object would need to have its own 16-element transform matrix (16x 32-bit floats), and that would consume a lot more memory and make it less likely that browser can hold 100K+ objects in memory.
The way batched geometries work, where single-reuse geometries are combined into the same arrays in GPU memory, that would actually require a 16-element matrix for every vertex in the model, which would get huge.
However, recently a user mentioned that they would like to be able to explode models. For that particular use case, we would only need a 3D vector per object, which could be 3x 32-bit floats, or even 3x 16-bit integers. For batched geometries, that's a translation vector per-vertex, which isn't that bad.
What's your use case? Do you need translate, scale and rotate, or would translation be enough?
We have the same use-case: exploding models so translation only is enough :)
Sweet - on the near-term road map it is!
Nice, thanks :)
Hi! Do you have any news?
Not yet! I have the plan for it clearly defined, but implementation of this one will need to wait about 2-3 weeks.
Hi,
Do you have any news on this?
Now implemented in 1.3.5 - see details in PR: https://github.com/xeokit/xeokit-sdk/pull/353
Run example: https://xeokit.github.io/xeokit-sdk/examples/#BIMOffline_XKT_metadata_moveStoreys
This lets me set offset from current position.
Is there any way to find position of Node vs Center of model ?
I would say const posToCenter = math.subVec3(node.position, math.getAABB3Center(model.aabb), math.vec3())
. If I'm right, I'll send a message to my high school math teacher x)
Problem with this is node.position is not defined.
I am using XKT loader and i could not find a way to find node position.
Oh, you're right.
node.position
for standard nodes are similar to performanceNode's offset (https://github.com/xeokit/xeokit-sdk/blob/master/src/viewer/scene/nodes/Node.js#L1027) and don't help here.
You can have the position of the center of the object with math.getAABB3Center(node.aabb)
, I don't know if it's enough
Great. This helped me.
Thank you for all help.
PerformanceNodes don't have rotate and translate methods. Is this something required in order to increase performances or we could implement it?
Solution
Now implemented in PR https://github.com/xeokit/xeokit-sdk/pull/353