# DOP POPs, Torque, Physics, and YOU

## Recommended Posts

Hey All:

This is a lay and perhaps naive approach I put together for getting rotations in H13. Attached is a file that has this approach. My physics no es bueno, so I'm wondering if anyone here can tell me if what I'm doing is kosher. It certainly seems to get me what I think I want. Here's an outline of how I went about it. I implore anyone here to tell me if there's a more correct or elegant solution.

1. Randomize the mass of the particles. This affects their speed/acceleration based on the force applied.
2. Calculate speed by getting the length of the velocity.
3. Create  a rotation axis based on velocity. I did this by getting the cross product of the normalized velocity and an up vector (0, 1, 0).
4. Set torque.x, torque.y, and torque.z to my rotaxis components.
5. Use speed to scale my torque.

Let me have it! I needs to know!

Thanks in advance. Attached is the file.

rotationPhysics.hipnc

##### Share on other sites

This is not a technically correct way of doing it. I'm hijacking torque per frame. Instead, it's probably best to set the orient attribute and use accumulated speed as the angle. I can't take credit for this, but you know who you are that helped. I'll be posting a simple file soon.

##### Share on other sites

Your setup is the way I like doing it as well -- the accumulated speed, that is. I like accumulating my length of my velocity in a 'traveldistance' attribute. This allows for much more post simulation control, as you can vary the amount of rotation per particle without having to re-sim. Also this is useful if you are doing any kind of crowds and remapping animation or anticipating acceleration which can trigger behavior.

I don't really like linking my axis of rotation to the velocity, since any kind of bounce can really abruptly change directions. So either I just chose a random axis per particle to rotate around based of the id of the particle ( could even be two axes which are blended over the particles age to make it a bit more interesting), or I actually update my coordinate system in pops (limiting the amount of change of direction my normal/up axes are allowed per frame).

##### Share on other sites

Thanks for the feedback Peter. I included a simple .hip file that has speed based rotation. Though, I do use the velocity and a cross-product with a random axis. This is using a quaternion VOP to bind the orient attribute.

rotationPhysics.v2.hip

Edited by fxrod

## Create an account

Register a new account