Jump to content

DOPs Initial spin at event.


mstarktv

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
Share on other sites

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

Link to comment
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.

Link to comment
Share on other sites

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

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

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.

Link to comment
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!

Link to comment
Share on other sites

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! ;-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...