Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why do you do this when making a turret fire a bullet at something?

Asked by 2 years ago

I was looking at tutorials for turrets and the line of code he used for the velocity is this. bullet.Velocity = turret.CFrame.LookVector * bulletSpeed I thought LookVector was the direction; How does the LookVector have anything to do with the velocity?

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

LookVector is to determine the position. Velocity is a calculation of the change in position. So basically it would determine how fast the bullet. Also velocity is deprecated so you don't want to use it.

Anyways here's the documentation

https://developer.roblox.com/en-us/api-reference/property/BasePart/Velocity

Ad

Answer this question