Sync object motion on collision
I’m making an archery game, where you shoot arrows at a target, and the arrows stay in the scene and stick into the object with which they collide. Stationary targets are fine, as they simply freeze motion and disable collision after they collide, but my problem is moving arrows once they have stuck into moving targets. I can’t use follower or teleporter gadgets because that would require me to create a tag in the exact location of the collision for each arrow. My closest attempt used the movement sensor attached to the moving target with local space enabled, wired to an advanced mover on emitted arrows. However the velocity output on the axis of motion from the sensor is much lower than actual speed. (I’m not sure if this is a bug, or intended behavior for relative signal strength). I can multiply this output to achieve the proper speed, however this causes erratic behavior such as arrows moving on collision, and also continuing to move a bit after the target stops moving. Any suggestions on better solutions? Thanks
-
How many moving targets will there be per level? Could you not create various trigger zones on the arrow which detect a specific target and upon detection activate a follower which is assigned that the specific target? not very efficient but should work!
-
Thanks for the response @IAMDOODLEBUG. To be clear, collision detection is functioning fine with impact sensors, so the number of targets isn’t necessarily my issue. My problem is with directly applying the speed and direction of the target to the collided arrows. I will experiment with the follower gadget though, thank you for the suggestion.
-
There are a few ways of doing this, but here's one you could try:
Add a tag to the moving target (inside the same group). It doesn't matter where it is as long as it moves with the target. Add a wireless receiver, with the zone around the target, with the tag's position being sent through it.
In the arrow, add a tag in the same group. Again, doesn't matter too much where it is. But here, it's worth snapping its white-dot position to a grid point. Add a follower, and set its white-dot position to the exact same point as the tag. Add a wireless transmitter to receive the target's position.
Set up a calculator to subtract the arrow tag position from the target position to find the offset. Send that through a signal manipulator and then freeze it (you may have to split and put the values through multiple sig-manips and then combine them again). Now you have the static offset of the arrow relative to the target.
Add the offset position to the current target position to find the scene position, and feed that into the follower's target position.
On collision, turn off "movable" if it's on. And turn on a follower.
This *should* work, though I haven't tested it for now. Hope this helps. ^^
iniciar sessão para comentar.