(TD game) Collision Trouble Or something like this

Hi everyone! I encountered a very annoying bug that really causes a lot of harm to the game!
Namely, my towers with a high rate of fire can sometimes start to slide and then fly off the map (Shown in the video)

I thought that there was something wrong with the physics, I set the value to Massles and added custom physics to make them immovable, but it didn’t help (although this bug was on all towers, but now it’s not on slow units).

I followed the Gnome code guide And the towers use BodyGear for targeting And I changed the aiming a little so that the towers did not look exactly at the HumanoidRootPart but simply towards the enemy because it looked very strange with tall enemies

Did you mean BodyGyro instead of BodyGear? If yes, then that might be the problem, since the object is long depracted and may cause bugs. I dont think its an error with collisions, since the troops cancollide should be set to false (i think). An alternative for BodyGyros are AlignOrientation. Here’s a page for it.

Why are the towers not anchored?

thank you, I’ll try to understand this now, but if it’s not difficult for you
How could i change the aiming? here is the script

local bodyGyro = Instance.new(“BodyGyro”)
bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bodyGyro.D = 0
bodyGyro.CFrame = newTower.HumanoidRootPart.CFrame
bodyGyro.Parent = newTower.HumanoidRootPart
This is adding
local targetCFrame = CFrame.lookAt(towerPosition, projectedTargetPosition)
newTower.HumanoidRootPart.BodyGyro.CFrame = targetCFrame
And this is aiming
I’ll write if I can fix it myself
Thanks in advance

I don’t know much about this but I can’t do it because of this
Network Ownership API cannot be called on Anchored parts or parts welded to Anchored parts

I just recently started learning coding, so I can make stupid mistakes due to my ignorance

Personally, I would put that in a Heartbeat event and adjust the CFrame using CFrame.lookAt(towerPosition, projectedTargetPosition). This sets the towers rotation towards the enemy CFrame every 1/60th of a second.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.