How to correctly get the velocity at an attachment's position?

I want to properly get the velocity vector at an attachment’s position on a part in world space.

Currently, I am facing an issue where my velocity vector does not make any sense. It is not pointing in the right direction. I expected the vector at the outer point of the propeller to be directed towards the inside.

The video below displays the problem, where the green vector visualisations are the velocity vectors of a propeller.

The code for obtaining the velocity vector that I used in the clip is the following:

local velocity = self.instance:GetVelocityAtPosition(attachment.WorldPosition)

Also, there is no documentation on the Developer Hub on what vector spaces are relevant for the output and parameter of the GetVelocityAtPosition method… I am confused and I thought that this would be easy.

1 Like

Definitely seems to be at the world position, and is following theory as expected with the velocity tangential to the path of the circular motion.

2 Likes

I am even more confused now. Apparently, self.instance.Velocity is inequivalent to self.instance:GetVelocityAtPosition(self.instance.Position).

-- Written in TypeScript (roblox-ts)

MediumResistance._visualizer.vector(
	this.instance.Position,
	transformDebugVector(this.instance.Velocity),
	BrickColor.Green().Color,
);
MediumResistance._visualizer.vector(
	attachment.WorldPosition,
	transformDebugVector(this.instance.GetVelocityAtPosition(this.instance.Position)),
	new BrickColor("Bright purple").Color,
);

The velocity vector is only incorrect for the propellors in the video. I tried to recreate this issue by making another set of propellors, but then it seemed to work properly. This is starting to look like an engine bug to me…

I am closing this topic. See the following one instead: