Jump to content

# Dynamic arrows sticking into moving geo.

## Recommended Posts

Hi, folks.

I need to set up a simulation where dynamically-generated arrows fly, then collide with a deforming surface and stay stuck to that surface (shields carried by moving

soldiers). Importantly, the arrows should NOT just align along the prim normal on collision; they should protrude at the angle at which they collided.

This is a topic that's come up before, but I haven't been able to find a satisfactory answer about it. Some suggestions don't quite hit all the elements I need; some are for older versions of Houdini and so might not be as relevant/accurate (I'm on H14).

The approaches I've considered are:

1. Particle-based arrows that stick. It's easy enough to copy arrow geo onto a particle sim, and have the particles stick to the collisions surface. However, then the particles have to start inheriting the orientation of the collision prim as it continues to move. This could be handled two ways:

• The collision geo is deforming. In this case I'll somehow have to calculate how the collision prim has transformed from the moment of impact to the current time.
• The collision geo is transforming. In this case I'd use rivets to attach non-deforming stand-in geo to the moving collision objects (which don't change shape). Not ideal, but it might make it easier to work with the orientation values?

2. Particle-based arrows that create geo. Having already grown sick of the mathematical jungle of quaternions, matrices, and dihedrals, I wondered if a better approach might be to make each particle spawn some geo in the colliding object's network instead (presumably using a SOP Solver?) , then die. This would hopefully eliminate the need to continuously update orientation.

3. RBD-based arrows with constraints. Moving away from particles altogether, I wondered about using simple Bullet geo for the arrows, and dynamically creating constraints to pin them to the shields when they impact. An advantage of this method would be that it would allow realistic stick-like collisions and bounces for loose arrows--something particles can't really do.

If anyone has any thoughts about which of these methods is most promising, or has any specific advice about how to implement them, I'd be extremely grateful to hear. Thanks in advance!

Edited by SteveSayer

#### Share this post

##### Share on other sites

i would opt for an arrow that flies that turns off and spawns an arrow that sticks in a shield.  leaving the flying arrow out of the equation since that's not terribly difficult...

the key sop here is the point deform sop.  you can use that put arrows into and out of your deforming shield's space.

first things first:

take an arrow and place stick it in your shield at your rest frame (frame 1 or -100 or whatever you want to use as a neutral position).

then push that geo into input 1 of your point deform.  push the rest pos into input 2 (timeshift your shield geo to your rest frame).  push the animated shield into input 3.

ideally that will now have an arrow stuck in your shield as it moves.

now the trick is to take an arrow at some frame and have it stick into your shield as needed.

that means a solver as your input instead of the static arrow.  you'll need to do the reverse mapping (moving shield as input 2, rest as input 3) to take an arrow in world space and merge it into your accumulated arrow group as input 1's solver.

that's how i'd approach things.  obviously there are details to sort out (like detecting when to do the arrow swap)... good luck!

#### Share this post

##### Share on other sites

Hello Steve,

Here's a quick solution. But maybe I'm overcomplicating things as always). Check the hip file attached.

Edit: I have just realized that you need scene in houdini 14)

arrowSimpleN.hip

arrowSimpleHou14.hip

Edited by Artem Smirnov
• 1

#### Share this post

##### Share on other sites

Thanks both for your suggestions.

I've actually made good progress with my second approach: I managed to set up a SOP Solver node to copy a point into a geometry container at each moment of impact. Those points persist and, since they're being created in a SOP that is riveted to the shield animation, they update their orientation automatically and correctly. Then I just copy the arrow geo on to them, and kill off the original colliding particles that created them.

Fathom, obviously if I got your solution working it would be more robust, since it would allow me to attach to deforming surfaces, and not rely on rivets and rigidly-shaped colliders.

Artem, I'll download your scene and have a look--thanks so much for taking the time! Also, if we're worried about overcomplicating things, we shouldn't be using Houdini, now, should we?

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

×
• Donations

• Leaderboard