Hi developers, I need some help finding raycast direction for the bullet, here is an example:
B - Vector3 We want to get
A - Object position
As raycasting does not allow us to use CFrames at all I really don’t know what to do, any help is possible?
Hi developers, I need some help finding raycast direction for the bullet, here is an example:
B - Vector3 We want to get
A - Object position
As raycasting does not allow us to use CFrames at all I really don’t know what to do, any help is possible?
I’m not exactly sure what you mean, but I’m assuming you wanted the direction to be where the Object A was looking?
local direction = part.CFrame.LookVector
local origin = part
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {part}
local raycast = workspace:Raycast(origin, direction * 10, params)
Look, as I said Raycast does not accept CFrames, at all, you always need to use Vector3
Also, no I’m not wanted Object Orientation
small correction it should be this:
local direction = part.CFrame.LookVector
local origin = part.Position
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {part}
local raycast = workspace:Raycast(origin, direction * 10, params)
i don’t see a cframe in the code above
what do you mean by this
Found solution, the solution was:
(script.Parent.CFrame*CFrame.new(-5,0,0)).Position
This function returns the exact Vector3 position from it’s Axis
If I understand correctly, you want to find the direction the raycast is working.
The direction will always be from 0, 0, 0
For example,
workspace:Raycast(Position, Vector3.new(0, 100, 0), RaycastParams)
will always be above the part.