[x3d-public] Scaling PositionInterpolators
John Carlson
yottzumm at gmail.com
Mon Apr 6 23:56:45 PDT 2026
Is there some way to scale PositionInterpolators with an MFVec3f scale
field to scale keyValues on initialization? This would be a nice
addition! I don’t know if Transforms or HAnim does it.
Google AI suggests this, but I don’t want to use a Script (these would be
key values, not keys).
function initialize() {
update_keys();
}
function set_scale(val) {
scale_vec = val;
update_keys();
}
function update_keys() {
var new_keys = new MFVec3f();
for (var i = 0; i < original_pos.length; i++) {
new_keys[i].x = original_pos[i].x * scale_vec.x;
new_keys[i].y = original_pos[i].y * scale_vec.y;
new_keys[i].z = original_pos[i].z * scale_vec.z;
}
scaled_keys = new_keys; // ROUTE this to PositionInterpolator.set_keyValue
}
I would say push the code to the browser, instead of more user code.
The example of this is getting a humanoid out of Blender 100 times the size
you want it to be. (Meters vs centimeters), and you’re incorporating the
humanoid into a scene that’s at a different scale. I would like to add
scale to the humanoid and the PositionInterpolators with fields. My
PositionInterpolators are built for < 2m humanoids.
Yes, I know about unit statements. Naively exporting JSON output from an
AI generated exporter does need to be fixed. I’m trying to add non-Blender
animations (not 100x). It’s a lot easier to add a scale to each
PositionInterpolator by hand than multiplying each keyValue value. If I
shrink the human by 100x, maybe the x PositionInterpolator is shrunk too?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20260407/afc05842/attachment.html>
More information about the x3d-public
mailing list