I am trying to create Tank that will shoot straight not to mouse position, how I can raycast from tank output part to the straight point, that’s gun pointing at?
My question may be confusing, but basically i want to make shooting tank, using raycast without using mouse, just to shoot straight… Any ideas?
Here is my example how I want to shoot straight (with 200 distance limit)
This resource on raycasting seems like it’d be pretty useful for your situation here. Just make the ray straight using LookVector instead of the mouse position
you can put 2 attachments in the tank gun, one located at the middle of the gun and another located at the tip, then use the positions of the attachments to calculate the direction.
Maybe something like…
I also just finished a little test. Not sure if it’s completely helpful but it’s cool to look at I guess. I’ve got to go, I’ll be back in a few hours hopefully to help some more! Good luck. raycast_demo.rbxl (16.4 KB)
quick add: this was accomplished using @johnnygadget’s idea, very clever!