How does tsbg apply force to do dashes?

i’ve been wondering how tsbg does dashes and how they work, do they use bodyvelocity?

2 Likes

Great question! TSBG — dashes with some interesting mechanics. I have seen a lot of developers implement this with BodyVelocity or another velocity applying object to make it so when you hit the charge button, your character would instantly move towards that direction.

Here are a few possibilities:

BodyVelocity: It is a means of instantaneously adding speed in a given direction. This dash effect we can get by setting velocity for short time.

Tweening: A few games utilizes TweenService to transition from one position to another smoothly and the player just appears to be dashing without any weird physics changes.

This is in addition to custom physics, where they may opt to forego the character controller and attempt to set speed of the character directssly by coding logic that applies different forces or tweaks parameters of characters.

If you are wanting to implement something similar, playing around with BodyVelocity or looking into pre-made modules like TweenService could be a good place to begin! Let me know if you have any further information!

1 Like

Ultimately there’s no way to know for sure, so I’m just going to take a (very biased because I love using them) guess that it probably uses an AlignPosition.

You can set the AlignPosition to use a single constraint, then just set AlignPosition.Position to whatever you please without needing to make a new attachment or whatever.

If you have the input vector (in my experience best obtained with the player module) you can do something like this:

local InputVector = PlayerModule:GetInputs().activeInputController:GetInputVector() -- i don't think it's this, im on mobile :3
local DashDirection = HumanoidRootPart.CFrame:VectorToWorldSpace(InputVector)
HumanoidRootPart.AlignPosition.Position = HumanoidRootPart.Position + (DashDirection * 5)

And then after some time just disable the align position.