How do I move a little object to the end point of my laser?
I've created a long straight stroke and placed it over my laser so I can see the laser in scene. I've also got the stroke to change it's end point to match the current hit location of the laser with a bit of logic. Now I want a little red dot at that hit location at the end of the laser, but I only want the red dot to be visible when I 'Hit' is being detected.
I've got some useful outputs from the laser scope including the Z position of the hit location (local to the scope) and the Hit Distance in meters. I just can't quite work out how to use the info in the right way to get a my red dot painting where I want it with the tools available (really think we should have a 'Position' gadget to just place stuff where we want).
I guess my question is, how do I work out the red dot's distance from the Laser's origin point in real time (without attaching another laser to the red dot) and have it constantly updating? And I need the measurement to local to the Laser Scope's axes.
-
Hi Spirit-X
I had a bit of a play with this and was semi successful.
What you can use is the Hit Position fat wire output of the Laser gadget as the input to a Follower gadget set to a Min/Max follow distance of 0 with a high movement speed and max dampening.
Snap the Follower gadget to something and it will animate your 'hit display' point to the exact point of impact.
I snapped the follower onto a microchip holding a TextGadget that I used as the hit point display. These can be set to appear over any other object in the Tweak menu so there was no clipping and it moved smoothly across the surface.
The issue I had is that the Follower gadget will take a frame or two to get to the hit point so you see a glitch whenever it switches between hit detected/not detected. This would work much better with a Teleporter gadget but that takes a Tag as an Input not a position so I couldn't figure out how to use that here. I worked around this with a 0.1s delay before I made the TextGadget visible and it's much smoother.
I shared my experiment as Spirit-X Hit Detect Demo. Have a look and see if it helps -
Nice, that's very kind of you to take the time to help me find a solution to this one. And I think it sounds like your solution is probably a little easier to set-up than what I came up with. I've been playing with an emitter, using the hit location fat wire to emit my red dot every 0.1s. It actually worked really well and looked surprisingly smooth...but it turned out that it would clip into objects and disappear when the laser got more than 90 degress away from the Z axis. Thought I should be able to solve with an adjustment to the Z distance of the dot (as I have everything set to "Local") but didn't work. I'm sure a few gadgets have a Local setting that doesn't actually do anything. I had a look at the outputs of my Laser Scope with and without Local set and they were no different. Weird.
Anyway, I'm gonna give your setup a go when I get on tomorrow. Thanks again for the great idea!
الرجاء تسجيل الدخول لترك تعليق.