I have a new project concept and thinking about the technical solution.
My main challenge is changing the diameter of multiple round objects based on user input.
Here is an example of what I want to achieve:
Any suggestion how to solve this in a more or less generic way?
Hints are welcome.
All Playcanvas entities can be easily scaled on runtime, using the setLocalScale method:
That way you can pass new values from your UI to one or more entities and update their size.
the thing is, that only a part of the entity is controlled by a paramters. If you look on the adapter with the thread. The connection to the shaft changes when you play with the diameter DS. But the whole enitiy keeps its size.
Another example her:
Change DSE and DS. It seems like this is one mesh and a part of the mesh is changing.
Aren’t you able to build the whole model using child entities/model?
The child entities will keep their local position as part of the hierarchy but you will be able to update their individual scale/size.
That is more or less what I’m asking
But I don’t know how I could do it cause they seemed to be connected.
I made a screenshot to show you what I’m meaning.
Especially at the first example here on the left, I have no idea how to achieve this with two separte entities.
At the second example on the right there is this small stage between the adapter and the shaft which makes it difficult I think. Without this detail I would easily use two entities here. Thanks for you time!
Right, so if I understand correctly what you need, here is my take on how I would approach this. Using parent/child hierarchy and a simple script with basic positioning rules:
- A/Z increase/decrease length
- S/X increase/decrease diameter