Projectile hit location not accurate

is what you are printing there projectile.touched ?

Yes, it is. I am printing what it returns in the function.

ok, and what exactly is projectile

Just a part with some values, a trail and a BodyVelocity

Your problem here is that the Baseplate’s Position is in the center of the baseplate. So the projectile lands there. Do not use touched, use raycasts instead.

Here’s an example. I will not write code for you. Use this basic code and work off of it, or make your own unique solution.

function rayCastforwardWithIgnoreList(part, ignore)
	local r = workspace:FindPartOnRayWithIgnoreList(Ray.new(part.Position, part.CFrame.lookVector * 3), ignore)
	if r and r.Instance and r.Position then
		return r.Position
	end
end

function on_Update()
	local lol = rayCastforwardWithIgnoreList(part, {workspace.SomePartWithItsDescendantsThatYouWantToIgnore})
	if lol then
		part.Position = lol
		-- anchor the part
	end
end

2 problems.

  1. I am making a projectile raycasting instantly gets the position.
  2. I have shields that deflect the projectile and it would be really hard to get the raycast of where the deflected projectile will end up.

Also, I am using the projectile’s position when it lands. Not the part it hit’s position. Therefore, it doesn’t end up where the part’s center is.

no. Thats not how it works.

if you need me to fix these problem for you, PRIVATELY DM me a place file with your (so randoms wont have your code).

if not, follow my advice on my previous post.

By the way, whats going on with my raycasting thing is it only raycasts in a small proximity

as soon as the projectile lands set the position of the projectile to a variable maybe that will help

I don’t think you understand. Try reading the rest of the messages in the thread.

I’ll try that. I never thought of that lol

It partially worked. The hit position is still really not accurate, but the particle effect is not going to the wand tip anymore!

No. I understand.

Have you set an ignore list?

also, I am telling you the raycasting thing because you SHOULD NOT USE TOUCHED.

Storing it as a variable will not help either

that’s good, the position might not be accurate because of the inconsistency with vector force. also alessdai is probably right, but the idea of a projectile actually moving with his spell system im assuming might work better and could b euseful later on

You didn’t read the entire thread. I clearly say here:

that the projectile returns whenever it hits any part of the wand or character

I listed my problems with his solution here.

Thank you for your solutions though!

1 Like

That is not the point. I am telling you that it is suggested that you use raycasts for more accuracy.

Your problems are flawed. It will NOT get the position instantly as it is only in PROXIMITY.
image

yeah im not quite sure how consistent .touched is especially in this situation.

I don’t think you understand what I mean by instantly. I mean right when the player clicks it will raycast. Maybe I don’t understand. Do you mean I should raycast where the projectile hits the part when it hits it?

it should be ran constantly. Not just once.

Ah, that is a good idea

I will try that and reply when I’m done.