Jump to content
mstarktv

DOPs Initial spin at event.

Recommended Posts

This has been a very hard search to find an answer to. What I'm trying to do is add an initial spin/rotation to a DOP object. I attached a simple scene of a torus that has an initial upward velocity and then just falls to the ground due to gravity.

Essentially, I'm trying to give it a "punch" that will cause it to spin - but not perpetually.

A good example would be if you had an object that hit "glass." Although the sim would be physically correct, to add interest it would be nice to add a little spin force to the shards of glass on the initial impact. I can't for the life of me find a way to do this in DOPs. I'm sure I could be overlooking the most obvious parameter, but it's also Houdini and sometime the simplest task takes some finagling. Any help is appreciated!

 

DOP_spin.hipnc

Share this post


Link to post
Share on other sites
Guest

What I usually do is to define the velocity and/or angular velocity at Geometry level that I want for my pieces on impact.
Then with a POP wrangle I sample those values and store them in a variable called e.g. "ivel".
If based on active values, I will sample the active value and store that in a variable called "aval".
I will also create a variable called "pact" that will store previous frames active value.


If the aval != to pact, I will then set to velocity or angular velocity to the sampled values stored in the variable.
And lastly set pact to be equal to aval.

A bit messy explanation, though I hope you get the idea. Otherwise I'm happy to put together a file demonstrating it.

That's the way I've been taught, however there's probably other solutions as well.
And this was based on active values.

Let me know if this makes no sense! :-)

EDIT:
Also hopefully my variable naming doesn't confuse you too much.

Edited by Guest

Share this post


Link to post
Share on other sites

I think it would be helpful to put a file together. I was trying to follow, but quickly got lost. Thank you, this is one of those tony things that is a big deal!

Share this post


Link to post
Share on other sites
Guest

Hopefully this clarifies it a bit.

If you're working with constraints, it's just a matter of checking wether it's still constrained or if it has been broken.

 

This is how I usually do this. But if anyone's got a better solution I'd love to see that! So I'll stay tuned :-)
Hope this helps.

initial_vel.hiplc

EDIT:
Instead of velocity you just wanna give it angular velocity instead, to get the spinning of your desire.
I've just added velocity in the given file.

Edited by Guest

Share this post


Link to post
Share on other sites

Hi

your file not work for me
i slightly changed assemble node, you take vel from packed geometry, but you can't do it because you must create it after pack or transfer vel on packed with "pack" node. Correct if I'm wrong

file

initial_vel.hiplc

Share this post


Link to post
Share on other sites
16 hours ago, mstarktv said:

This has been a very hard search to find an answer to. What I'm trying to do is add an initial spin/rotation to a DOP object. I attached a simple scene of a torus that has an initial upward velocity and then just falls to the ground due to gravity.

Essentially, I'm trying to give it a "punch" that will cause it to spin - but not perpetually.

A good example would be if you had an object that hit "glass." Although the sim would be physically correct, to add interest it would be nice to add a little spin force to the shards of glass on the initial impact. I can't for the life of me find a way to do this in DOPs. I'm sure I could be overlooking the most obvious parameter, but it's also Houdini and sometime the simplest task takes some finagling. Any help is appreciated!

 

DOP_spin.hipnc

You could simply modify "w" attribute after packing the objects and it should inherit angular vel after you turn on inherit velocity from point velocity in rbdpacked objects inside dop.

Share this post


Link to post
Share on other sites
Guest
1 hour ago, Deviner said:

Hi

your file not work for me
i slightly changed assemble node, you take vel from packed geometry, but you can't do it because you must create it after pack or transfer vel on packed with "pack" node. Correct if I'm wrong

file

initial_vel.hiplc

Yeah sorry, my bad it all went a bit fast when making the file.
So pack, then calculate velocities or angular velocities, and then you should be good to go.

 

initial_vel_v002.hiplc

Share this post


Link to post
Share on other sites
5 hours ago, Navneet Arora said:

You could simply modify "w" attribute after packing the objects and it should inherit angular vel after you turn on inherit velocity from point velocity in rbdpacked objects inside dop.

By any chance, could you use my file to demonstrate what you mean? @judnas example was a little over my head, although I got the gist of what he was doing. I'm not there yet to where I'm giving primitives velocities from another object.

The simplest thing I'm trying to do is just introduce random spin to Dynamic Objects and not POPs (Although they are in the same world now).

Thank you, though. I will try to do your method. I'm not the most familiar with manipulating velocities or forces in general through VEX, yet.

Share this post


Link to post
Share on other sites
Guest

Maybe I misunderstood something. I thought you wanted velocities applied, on fx. an impact.

However if you just wanna give it some initial angular velocity it's just as Navneet describes.

I've attached a file showing how to apply velocity and Angular velocity on the packed object using VEX.

DOP_spin_stark.hipnc

Share this post


Link to post
Share on other sites
4 minutes ago, judnas said:

Maybe I misunderstood something. I thought you wanted velocities applied, on fx. an impact.

However if you just wanna give it some initial angular velocity it's just as Navneet describes.

I've attached a file showing how to apply velocity and Angular velocity on the packed object using VEX.

DOP_spin_stark.hipnc

You didn't misunderstand it, really. I think I kind of overstepped where I was vs where I was trying to end up. Eventually(Once I have more of a working grasp and muscle memory for it), I'm 100% going to refer back to your setup. It's more or less I'm trying to manipulate things singularly and then expand beyond to things like your example.

In any case, thanks so much for helping me out. This has been the biggest pain.

Share this post


Link to post
Share on other sites
Guest

Not sure if the later file was of any help then, but feel free to write me a message if you need any further help :-)

Share this post


Link to post
Share on other sites
7 minutes ago, judnas said:

Not sure if the later file was of any help then, but feel free to write me a message if you need any further help :-)

Oh it definitely was. I'm sort of embarrassed that all I've had to do was add:

 

vector v@; //Velocity
vector @w; //Angular Velocity
@v = {x, y, z};
@w = {x, y, z};

This may be overwhelming for a question on such a simple thing. But, let's say I had it so that on the "hit" and if it's "true" that this would start the above code on the hit event and never stop; would the velocity snap into a new rotation(due to the @w), or would it ease into it and then carry through the rest of the simulation?

I know there are ways around that happening to where it just snaps into a new rotation. But, I think I'm more curious about the most stripped down, least amount of code behavior.

Share this post


Link to post
Share on other sites
Guest

It would snap into the new rotation if you just set the angular velocity to be equal that. But then you can then blend between the current velocities and the new ones.

fx. by sampling the frame where it would be applied, and then over 5 frames, fit from the current velocities to the new ones. I hope this makes sense.

Share this post


Link to post
Share on other sites
5 minutes ago, judnas said:

It would snap into the new rotation if you just set the angular velocity to be equal that. But then you can then blend between the current velocities and the new ones.

fx. by sampling the frame where it would be applied, and then over 5 frames, fit from the current velocities to the new ones. I hope this makes sense.

It makes total sense. That was exactly what I was thinking. Just add a blend and I'm good to go. Seriously, THANK YOU!

Share this post


Link to post
Share on other sites
Guest
1 minute ago, mstarktv said:

It makes total sense. That was exactly what I was thinking. Just add a blend and I'm good to go. Seriously, THANK YOU!

You are absolutely welcome!
I'm staying tuned for some more Houdini stuff on your Vimeo! ;-)

Share this post


Link to post
Share on other sites

Awesome! Thanks. They are mostly just ways to combine things I've learned and apply them into something practical...also, so I don't forget how I did it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×