So I have the CFrame of the enemy and the player how can I find the position of the part?
(The part is 10 studs behind the player from the enemy)
I have tried messing around with vector3 and CFrame and can’t really get it to work.
So I have the CFrame of the enemy and the player how can I find the position of the part?
(The part is 10 studs behind the player from the enemy)
I have tried messing around with vector3 and CFrame and can’t really get it to work.
I dont know what you mean, you want to find the position of the part? If so, cant you just get the position with part.Position
?
This is a visual representation, in the game I am trying to find the part’s position without the part
You could try this:
local cf = Character:GetPivot() -- 'Character' should refer to the player's character
local studs = 10 -- distance behind the player
local endPosition = -cf.LookVector * studs -- this returns the Vector3 Position 10 studs behind the direction the player is facing
If you’re looking for something more specific (like the head), you could just use Character.Head.CFrame
, etc
playerPosition + (playerPosition - enemyPosition).Unit * 10
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.