Attach projectile to target after hitting it
I have a target that is hanging on e.g. chain and is moveable. I shoot an arrow at it and upon collision it interacts with the target as expected, pushing it around. What I would like to do at this point is to stick the arrow the surface of the object that it hit.
The closest I could get was when I spawned a new static projectile upon collision inside the target. I could get the location of the collision from the collision detector but not the orientation. Any ideas how this could be achieved?
Well, the object to emit has to be part of that group. But the emitter can be in the projectile. That's what I meant. Which would work depending on how many such targets you have of course :D
Alternatively, send the scene space transform through wifi? Sounds like that's what you ended up with anyway.
Hey guys, thanks for the suggestions.
CLOUD1985: The laser scope orientation output gives you the normal of the surface the laser hits. Not good for a sideways hitting arrow.
TAPgiles: That works for static targets. But in this case the projectile HAS to be emitted from the target as it has to be part of that group in order to glue properly. The arrow swings together with the bag after the hit. Or the dummy shot with an arrow should have the arrow sticking out from it while the dummy limps away.
Anyways I figured it out, so let me share my solution with you:
As I said, the emitter has to be inside the target group (e.g.) the bag hanging at the end of the rope.
The arrow projectile has
- a tag,
- an input splitter getting the rotation info from the tag
- and a wireless transmitter broadcasting that rotation data
The bag has
- an emitter,
- a collision detector,
- a wireless receiver to get the arrow rotation data
- an input combiner
The input combiner combines the collision position with the arrow rotation data in a transform object that is used on the emitter position. And voila. (mind you the glued arrow has to be mirrored compared to the hitting arrow for this to work perfectly)
The swinging target will be featured in the coming level for Archery VR on dreams :)
Or emit it from the projectile, and you can line the preview up perfectly.
The laser scope has an orientation output that can be fed into an emitter to emit an object in a certain direction or orientation.
Its handy to emit things to match impacts on certain surfaces accounting for the surface angle.
It can take a bit of fiddling with settings to get the effect you want.