Linear Velocity rotating the Character

So bassicaly i had a combat system using Body Velocity, that you dash a little every hit, now i started use Linear Velocity, but that happens:

I made some tests to check: Universe 0 Royale Redo - Roblox Studio 2022-04-17 14-58-11

that makes no sense the code is simple

attachmentVelocity.Parent = humanoidRootPart
linearVelocity.Parent = humanoidRootPart
linearVelocity.Attachment0 = attachmentVelocity

linearVelocity.MaxForce = 1e6
linearVelocity.VectorVelocity = humanoidRootPart.CFrame.lookVector * 16

I tryed others posts on dev forum and on youtube, find no answers, code on client.

4 Likes

Because of your animation, the HumanoidRootPart could be changing it’s position and rotation before you call the movement again. I suggest at the start of the attack, define the look direction in a variable that doesn’t change and see if that works.

local lookVector = humanoid.CFrame.LookVector * 16

Not sure how you’re applying the force, in a timed loop perhaps? Whatever method you use, when setting the force of the linear velocity use the lookVector variable instead of the current root CFrame.

try doing:

dragForce.RelativeTo = Enum.ActuatorRelativeTo.World

Default the direction is relative to attachment direction I believe.

its already actually

animations change humanoid root part position?

I thought so, not sure anymore however. The new video you shared definitely rules out my solution, not sure what could be causing rotation like that.

can be the attachment orientation?

It always rotate for the same point

Just realized something, my first time with linear velocity as well.

The force is applied at the attachment position not at the center of mass which is the main reason why.

There doesn’t seem to be a center of mass option as well, seems very incomplete vs vector force.

1 Like

So nothing i can do about it? or have a solution?

i mean but the attachment is on the center of humanoid root part

1 Like

I believe just use body velocity for now and wait till Roblox fixes it.

So i figured out, my sword for some reason cause thats, i disabled the script that put the sword, and stopped happens.

THE SOLUTIONS IS: IF YOU WELD SOMETHING ON ANY PLAYER CHARACTER PARTS MAKE SURE SET IT MASS LESS TRUE, because 1 part on my sword that was mass less false that was happening.

4 Likes

Yup. Having the same issue, it’s pulling my player not at the center (even tho my attachment is in the center??), but for some reason at an angle and causing it to spin around instead of simply go forward. Don’t know why there isn’t an option to apply at center of mass or some other option…

1 Like

I actually just found a solution to this. Basically all you need to do is set the position of the attachment to the center of mass of your character. The simplest way to do this is:

Attachment.WorldPosition = HumanoidRootPart.AssemblyCenterOfMass

This also fixes the direction being slightly off while having the linear velocity relative to Attachment0 instead of World.

13 Likes

Ik this is late but thank you so much, i should have thought of looking in the attachment instead of all over the bodymover!

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