How do I turn a velcoity into a cframe? I want something like: vector3 * speed = cframe
What exactly do you want to do with velocity? Do you want to move a part by the velocity?
The CFrame constructor accepts a single Vector3 value which becomes the position element and the rotation matrix is left empty.
--example
local velocity = Vector3.new(1, 2, 3)
local cf = CFrame.new(velocity)
If you want to move a part by a so-called velocity, you can simply translate the CFrame by the velocity:
part.CFrame += velocity --velocity being a Vector3
oh sorry I mean that if the velocity was straight up then the part would rotate so it facing straight up
So you want the part to look in the direction that its going?
If so then use CFrame.LookAt()
Part.CFrame = CFrame.LookAt(Part.Position, Part.Position + Part.Velocity)
Correct me if I’m wrong.
That seems right, but Im getting an error…
The function is suppose to return a CFrame because I am setting a cframe to the function
May I see the rest of the code?
What values do “position” and “velocity” represent? A general example would be useful, i.e; if they are numbers, Vector3s etc.
The red dot there is a breaking point, it stops the script at that point
its CFrame.lookAt not CFrame.LookAt
yes I did that for testing as you can see its at a return line
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.