How to use the Lua script to change an object's shape?

Typically: "How do I... ", "How can I... " questions
Post Reply
dada_17528
Posts: 2
Joined: 24 Jun 2021, 10:04

How to use the Lua script to change an object's shape?

Post by dada_17528 »

I want to change an object's shape by customization script, but the Lua API
function ”sim.setObjectSizeValues(obs,shape_value)“ has no effect nor the
console gives any errors.
How to correctly use "sim.setObjectSizeValues(obs,shape_value)"?

coppelia
Site Admin
Posts: 10366
Joined: 14 Dec 2012, 00:25

Re: How to use the Lua script to change an object's shape?

Post by coppelia »

Hello,

from the documentation, sim.setObjectSizeValues has no influence on the object real sizes. Instead, use sim.scaleObjects (isometric scaling) and sim.scaleObject (non-isometric scaling when possible).
Additional functions that can be useful are float[3] xyzSize=sim.getShapeBB(number shapeHandle) and sim.setShapeBB(number shapeHandle,float[3] xyzSize) (with CoppeliaSim V4.2.0+, currently undocumented function).

Cheers

Post Reply