3dsmax FFD transform control point manipulation by script - controls

Hello everyone interested in maxscript,
I would like to make a batch of rock models deformed by FFD. To achieve efficiency, I need to write a script to manipulate the control points for random deformation.
I opened the listener and move the control point manually, but no message pop up to offer reference. So it seems hard for me to solve this problem on myself.
Could you kindly give me a concise example on how to do that? Thank you very much!!!
Best,
Yiyang

FFD control points are animated like editable mesh vertexes.
Hopefully this will work:
b = box()
addmodifier b (FFD_2x2x2())
animateAll b.modifiers[#FFD_2x2x2]
getPropNames b.modifiers[#FFD_2x2x2] #dynamicOnly --prints properties which you can animate
with animate on
(
at time 50
b.modifiers[#FFD_2x2x2].Control_Point_1 = [0,-2,0]
)
playanimation()

Related

How to make a "Springy curve" in Flutter for a button scale effect?

I'm trying to make a pleasing "spring" effect to scale a button and other components. In particular I want to scale them in when the view is created and shown, and I want to scale them down when a user taps a button, and if the user releases the button, I want them to scale back up to normal size with the spring effect.
The Facebook library "rebound" is a perfect example, see their demo here: https://facebook.github.io/rebound/.
I tried all the built in curves like bounceIn/Out and elasticIn/Out but they weren't springy enough (elastic is kind of springy).
Any help greatly appreciated!
As #Remi said, you can use the Curve class and override the transform method.
The difficult part is then figuring out the formula to use. I'd play around with something like this curve calculator to get a formula.
i.e. -(e^(-x/a) * cos(xw)) + 1 with a = 0.15 and w = 19.4.
Another alternative is to use existing curves together - since they all start at 0 and end at 1, you can simply multiply two different curves together in your overloaded curve method.
I'd take a look at the implementation of ElasticIn and ElasticOut to figure out how they did the math, but the dart math library should have everything you need.
You can create your own Curve by overriding transform.
As long a mycurve.transform(0) == 0 and mycurve.transform(1) == 1 you can do pretty much anything.
Better late than never:
you may find the package https://pub.dev/packages/sprung useful.

Smooth animation of three shapes in SciLab

This answer provides a nice way to make smooth animations in SciLab. I now have to write a simulation of a body attached to two strings (and therefore its movement regarding some additional forces).
The code in the link works well to render movement of a single point and, unfortunately, I didn't manage to make an animation of a point + two lines using this method. If someone is curious, I tried this code to do it:
frametime=(tk-t0)/Nt//defining the waitnig time
plot(Y(1,1),Y(2,1),"o")//plotting the point
plot([0;Y(1,1)],[0;Y(2,1)],style=1)
plot([D;Y(1,1)],[0;Y(2,1)],style=1)//plotting the two initial lines
h1_compound = gce();
h_point=h1_compound.children
h_point.mark_size = 20;
h_point.mark_background = 2;
h_line1=h_compound.children
h_line2=h_compound.children
//h_axes = gca();
//h_axes.data_bounds = [0,-1;10,1];
realtimeinit(frametime);
for i=1:Nt//my vectors have Nt points
realtime(i);//wait "frametime" seconds before drawing the new position
h_point.data=[Y(1,i),Y(2,i)];
h_line1.data=[[0;Y(1,i)],[0;Y(2,i)]]
h_line2.data=[[D;Y(1,i)],[0;Y(2,i)]]
end
The question is: is there any way to make an animation of three shapes without making axes blink (as it is with the window refreshment) or other wierd stuff?
Since you didn't create a MCVE I can't reproduce your exact problem. But you may try to add drawlater(); before, and drawnow(); after your data modification to see if it does help with blinking or not.
Or you may get much better looking result by saving your plots in every round with xs2gif and assemble the animation with another gifmaker progam (there are free online sites to do this, however with some limitations). If you need to present your result, you should do this step anyway.

sf::View visibility Check

Ok, so I've been working on a game with some friends for a school project. We have used SFML.
I've been working lately on the camera and a tile implementations system and now I need them to work together.
The camera works like this:
I have two different sf::View, one for the game world and one for the hud. The one for the game world follows the player in the x-axis.
The tile system works in a way where it reads in a txt file and draw sprites based on the information from the txt file.
As it is now I always draw all the tiles, even if it's outside of the cameras view. Not good. I need a way to check if the tiles are outside of the cameras view before I draw them. How do I do this?
I did find this:
Get X and Y offset of sf::View
but I can't really wrap my head around how to make this info work in my game.
Any help would be really appreciated! :)
Mvh Elis
Managed to figure it out after finding this:
http://fr.sfml-dev.org/forums/index.php?topic=10590.0

Export Blender Particle System Hair To Three.JS

After several months of casual research on three.js as I work on a model in Blender 2.7 I have yet to locate a method for exporting the blender particle system hair? By chance would anyone have any ideas how would I go about achieving this feat, would I need to perhaps export to OBJ or some other format? I have yet to see any three.js imported particle systems from any 3d system?..Any ideas would greatly appreciated !!
The method I use is make your particle hair. Then, under the modifiers tab, select "convert" to convert it into a mesh.
Next add the "screw" modifier. Set the objects center accordingly to get the best "screw" results. Use X, Y, or Z axis, and change to 2 degrees. Change the number of sections to 2 as well.
This will make a mesh like hair.
This solution is a visualized version stated by beiller.
Step by Step
Go to Modifiers.
Click Convert.
Now the hair become like this.
Add Screw modifier to the hair and so change the Angle to 2.
Click Apply.
Export your model to what file format you need.

Dynamically(at some time intervals) change textures on a plane/cube in three.js?

I know it's something with texture.needsUpdate() while rendering but I don't have a clue how to actually implement it. Maybe someone knows a link where I can see a working example or post some piece of code? Cheers.
An excellent question; I created some sample code to do exactly this -- using a spritesheet to do some 2D animation on a plane and on a cube, which requires regular updates. Here is a link to a documented example, that in particular contains a function to do exactly what you need.
http://stemkoski.github.com/Three.js/Texture-Animation.html
Hope it helps!

Resources