Solver SOP - Simple movement
4659 18 0- SteN
- Member
- 55 posts
- Joined: March 2015
- Offline
So im trying to develop somekind of “growing based of time” stuff, and I saw that for this kind of stuff you need to use a solver sop(seems obvious).
So to get used to the Solver SOP i tried something simple: I created 2 points in space, one is and the other is , then I created a sphere in , wired those 3 into a Solver Sop and inside of that I attached a wrangle wich looks for the position of the sphere, and if its not equal to the P of the second point, it increases it by 0.1 units in every axes (this way it will get closer to the 2nd point).
When the P of the sphere and the P of the second point will be equal, the sphere should turn green (initially it was red) and never move again.
The problem here is that even if the sphere reaches the position (on the 10th frame), it doesn't turn green, and keeps moving in the next frames…
I attached the scene so you can have a look at it.
Thanks
Edited by SteN - Sept. 3, 2016 17:48:51
- patar
- Member
- 280 posts
- Joined:
- Offline
- patar
- Member
- 280 posts
- Joined:
- Offline
- SteN
- Member
- 55 posts
- Joined: March 2015
- Offline
Thank you so much.
This isnt the first time I have problems when comparing values in houdini, not gonna try again
So basically to get that to work you dont check if the two values are equal, but if the two values are more or less close?
Thanks again for your time.
This isnt the first time I have problems when comparing values in houdini, not gonna try again
So basically to get that to work you dont check if the two values are equal, but if the two values are more or less close?
Thanks again for your time.
Edited by SteN - Sept. 4, 2016 17:24:09
- patar
- Member
- 280 posts
- Joined:
- Offline
- SteN
- Member
- 55 posts
- Joined: March 2015
- Offline
- animatrix_
- Member
- 4508 posts
- Joined: Feb. 2012
- Offline
And if you want to squeeze some performance use:
if(distance2(_pB, @P) > tolerance*tolerance)
...
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
- patar
- Member
- 280 posts
- Joined:
- Offline
- SteN
- Member
- 55 posts
- Joined: March 2015
- Offline
- patar
- Member
- 280 posts
- Joined:
- Offline
in programming world some operation is faster than the other its due to how to computer does calculation…like in assembly shl and shr is alot faster than multiplication..
u can use performance monitor if you r curious about the speed of nodes in your scene which slowing your computation which can be optimize…
besides length(_pB-@P) is 2 operation distance2(_pB, @P) is one…
im not realy up to optimizing my code unless its reaaaaally slow…
i often ended up creating my own stuffs from scratch if thats the case… stuffs like flip volume source…
i like to create my own since i will only use stuffs that i really need…
u can use performance monitor if you r curious about the speed of nodes in your scene which slowing your computation which can be optimize…
besides length(_pB-@P) is 2 operation distance2(_pB, @P) is one…
im not realy up to optimizing my code unless its reaaaaally slow…
i often ended up creating my own stuffs from scratch if thats the case… stuffs like flip volume source…
i like to create my own since i will only use stuffs that i really need…
- animatrix_
- Member
- 4508 posts
- Joined: Feb. 2012
- Offline
SteNpusat
And if you want to squeeze some performance use:if(distance2(_pB, @P) > tolerance*tolerance)
...
Why should this give better performance?
Because sqrt is slow. Avoid it if you can.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
- SteN
- Member
- 55 posts
- Joined: March 2015
- Offline
Yes ok, I got it.
After implementing this I came up with a new issue, wich is not realated to this last change.
So if you take a look into the code you will see what Im trying to do:
-On frame 1 I record the position of the target, wich is the blue point you can see in the 2nd screenshot, and I also calculate what I have called _moveStep, wich basically given an amount of frames, this should be the amount wich the sphere has to move on each frame, to reach the target in that amount of frames.
-Then for every next frame (if @Frame > 1) I do the check and then move along the Dir Vector (vector pointing to the target), wich you can see in the 2nd screenshot too (the red one).
The problem here is that _moveSteps changes in future frames even if I calculate it only on Frame 1.
In the 3rd frame you can see the result of all the printf I wrote to check where the varaible was being modified, and again, for some reason it changes even if I calculate it only on Frame 1.
After implementing this I came up with a new issue, wich is not realated to this last change.
So if you take a look into the code you will see what Im trying to do:
-On frame 1 I record the position of the target, wich is the blue point you can see in the 2nd screenshot, and I also calculate what I have called _moveStep, wich basically given an amount of frames, this should be the amount wich the sphere has to move on each frame, to reach the target in that amount of frames.
-Then for every next frame (if @Frame > 1) I do the check and then move along the Dir Vector (vector pointing to the target), wich you can see in the 2nd screenshot too (the red one).
The problem here is that _moveSteps changes in future frames even if I calculate it only on Frame 1.
In the 3rd frame you can see the result of all the printf I wrote to check where the varaible was being modified, and again, for some reason it changes even if I calculate it only on Frame 1.
Edited by SteN - Sept. 6, 2016 06:04:26
- SteN
- Member
- 55 posts
- Joined: March 2015
- Offline
- patar
- Member
- 280 posts
- Joined:
- Offline
The way you set it up
_moveStep will never get a value after frame 1
coz that variable is only exist on that particular point wrangle
thats why if you look at your snapshot once it get to frame 2 the value no longer 1/48 ( which is 0.0208333)
instead it get whats in the memory at that pointer variable which some random number
as usual here i attached the fix…
sorry about the delay i was quite bussy…
got the time when my pc is simulating heheh got nothing better to do than… this stuffs..
best regards
Patar
_moveStep will never get a value after frame 1
coz that variable is only exist on that particular point wrangle
thats why if you look at your snapshot once it get to frame 2 the value no longer 1/48 ( which is 0.0208333)
instead it get whats in the memory at that pointer variable which some random number
as usual here i attached the fix…
sorry about the delay i was quite bussy…
got the time when my pc is simulating heheh got nothing better to do than… this stuffs..
best regards
Patar
- SteN
- Member
- 55 posts
- Joined: March 2015
- Offline
- patar
- Member
- 280 posts
- Joined:
- Offline
- SteN
- Member
- 55 posts
- Joined: March 2015
- Offline
Yes ok, thank you
After that I added stuff to make the sphere follow the target even if its position is modified, even interactively.
Btw I did this thing because Im trying to develop another thing, and this should be the “foundamental” part of it…hope I can get it to work entirely
I post the file for reference.
Thanks again!
EDIT:
If I try to make a line between the two points this is what I get http://prntscr.com/chlhva [prntscr.com]
To solve this I used an object merge and get the points to another GEO node and then create the line, and that fixed it…I guess that “glitch” is because by the timeshift nodes…?
After that I added stuff to make the sphere follow the target even if its position is modified, even interactively.
Btw I did this thing because Im trying to develop another thing, and this should be the “foundamental” part of it…hope I can get it to work entirely
I post the file for reference.
Thanks again!
EDIT:
If I try to make a line between the two points this is what I get http://prntscr.com/chlhva [prntscr.com]
To solve this I used an object merge and get the points to another GEO node and then create the line, and that fixed it…I guess that “glitch” is because by the timeshift nodes…?
Edited by SteN - Sept. 13, 2016 13:37:57
- patar
- Member
- 280 posts
- Joined:
- Offline
- patar
- Member
- 280 posts
- Joined:
- Offline
-
- Quick Links