hello people. i am using applyimpulse to launch a projectile, however, the projectile is always launched along the same direction.
is there any way to fix this so that it is launched along the direction the projectile is facing?
you can set the velocity based on the lookvecter
here’s an example I wrote
part.velocity = part.CFrame.lookvector * 10 -- change 10 to speed
part:ApplyImpulse(part.CFrame:VectorToWorldSpace(force))
also, forward is the negative Z direction btw
1 Like
if it’s just in the direction of the look vector, you can just use CFrame.LookVector
, but I believe you can translate any Vector3 value to object to world by doing CFrame:PointToWorldSpace(relativePos)
or translate a CFrame by doing CFrame:ToWorldSpace(relativeCFrame)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.