Jump to content

How could i get this random facing but rotate by a direction in instance?


vinshm

Recommended Posts

On Saturday, August 20, 2016 at 4:30 AM, MirrorSword said:

Could you explain in more detail what you are trying to achieve? Do you want the particles to first have a random rotation applied, and then be rotated based on the particles velocity?

yes,that`s what i want.sorry about my english,just can`t get an idea to deal with this keep random rotation state first in instance

Link to comment
Share on other sites

So I made an example of how I would accomplish that task. If you check out this page. You'll see that the "rot" attribute is a final rotation applied after all the other rotations. So if your points have "v" and "rot" attributes, the objects will first be rotated in the direction of the velocity and then rotated by the "rot" quaternion. I also calculate the "rot" attribute before the particle system so that it won't change during the simulation (although it shouldn't matter for this example). to calculate the rot attribute I use the point number to create a random vector within the range 0 to 1 and then remap it to the range -1 to 1.  I then normalize that and use "look at" to convert it to a matrix that points in that direction, and then finally convert that matrix to a quaternion. There's probably a better way to calculate that but this works.

Anyway let me know if you have any questions.

:)

rotate_in_copy_v2.hip

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...