TDS type unit placement

Hello everyone!
im trying to copy TDS Tower/Unit placement where if the mouse move fast enough the tower will like fall to their back, like in this recorded TDS video

if anyone know please help

1 Like

I don’t have a deep understanding of trigonometry and all that stuff, but I might have a suggestion on how this works.

Instead of instantly snapping the position of the unit, try tweening it and at the same time use CFrame.lookAt to make the character tilt towards your mouse.
The 2 pictures below should visually describe how this is done

ahdkjakjsa1png

ahdkjakjsa2png

If youre using runservice to constantly track the unit to your mouse, i think you should do the following

  • Make a Variable for the position of the unit at the very start, and another for its CFrame
  • In the runservice loop get the position of the unit currently
  • Get difference of the current position and start position
  • Convert the difference into an angle (by converting to radians), put this angle into a CFrame with the position of your mouse
  • Lerp the variable for the units CFrame towards your new CFrame by whatever alpha you want

You may need to change the difference of the positions in one or two more ways to get a correct tilt, since i just came up with all of this in my head
Best of luck

im using RunService and Lerping to move the unit mouse current position, but i dont really understand what u mean and how it can make the unit become like tds placement system like how do i convert it to radians and how does radians gonna make it like falling to its back or the opposite direction of where they are heading

i dont think u understand what i mean,

so i want to make a unit placement system like TDS where if the mouse move fast enought, it will make the current selected unit to move to mouse position and also kinda fall to the opposite direction of where the mouse currently heading

I think you should use something like mouse delta but try to make it work without the player having to be in first person and make the tower rotate base on where the camera is facing, but I’m trying to find a way to make it work properly without causing more lag.

what :sob:

how first person and tower rotate base to camera face gonna work on tds like placement system?

i meant make mouse delta trackable without have to be in first person mode

Yeah, my solution would achieve that. About “when mouse moves too fast”: you can check the last position of the mouse and subtract it from the currect one, giving you the difference in the distance. Just check if that value is high or not.