- Home /
How to create a cube in 2d view and scale it based on a point/anchor? Than visualize the cube in 3d.
I want to create a cube/wall in 2d view and change its scale from one side based on a pivot or anchor, after that see the cube in 3d view.
Here is a youtube link/example of what I want to achieve: https://www.youtube.com/watch?v=53bWbujdBl8
basically taking a room shape and manipulate its scale than view in 3d. The live demo is available here: https://visualizer.somanyceramics.com/
Hello,
in my opinion, you could do two thinks:
you could write a very difficult Auto$$anonymous$$esh .dll wich cut the $$anonymous$$esh there were it overlapped and should be clamped.
or you make it with the two variables- like you wrote: you could try somethink like this:
public float maxdeformation; //max. deformation
public float $$anonymous$$deformation;// $$anonymous$$ deformation
public float defor$$anonymous$$g; // this is the current deformation high- you must convert the polgons
count to a float
void Update(){
if(deformation > maxdeformation) {
//here comes your code wich increase the deformation
}
else{
//here comes your code if the deformation is to small
}
else if(defor$$anonymous$$g<$$anonymous$$defor$$anonymous$$g){
//here comes your code wich decrease the deformation
}
}
im not sure - maybe this works.
I hope i could help you,
12t
I will download this code- will try to do this and send it back to you :)
Answer by K_Tec · Feb 22, 2017 at 01:52 PM
Do you mean inside the Editor? Inside the Editor you could use the rect Transform. https://docs.unity3d.com/ScriptReference/RectTransform.html
if you mean in runtime you could write a script with set the Camera state to Orthographic than to Perspective. Thats Mesh derform, wich is difficult in Unity- but possible.
I took your suggestion and tried $$anonymous$$esh Deformation. I am now able to achieve the effect upto a certain extent. I am attaching the script I used for this(change the extension to '.cs' after downloading) .
The FULL TUTORIAL YOU CAN FIND HERE: https://www.youtube.com/watch?v=c-pqEHR1jnw Tutorial by matt...
However, there is another issue I am facing now. When I deform the mesh(cube in my case). It is very extreme. I want to limit the deformation to clamp between two values.
Here is a youtube link describing the issue.
I am also attaching screenshots. The second image explains my issue.
Your answer
Follow this Question
Related Questions
How can I load 3d models(.obj, .fbx) dynamically in to unity scene after building it to WebGL ? 1 Answer
Keeping textures unstretched even as a gameobject scale is changed 1 Answer
How expensive is scaling in 2D unity? Is it better to pre-scale? 1 Answer
Scaling in Runtime 2 Answers
Building a NavMesh at Runtime 1 Answer