LookVector Not Accurate?

I am making a throwing system where when the player clicks their mouse it sends a ball flying. I use the player’s HumanoidRootPart’s LookVector from CFrame and times it by 1000 to create the force to send the ball flying. However, it’s accuracy isn’t consistent. At times it seems to be accurate and other times it doesn’t (specifically when I turn my back towards the boss it becomes very inaccurate).

It would help if you provided us the script that calls the ball to move in the Character’s HumanoidRootPart LookVector :slightly_smiling_face:

1 Like


To clarify, I make the player stop by setting their WalkSpeed to 0 so that it looks more realistic to me.
I also set the Y force value to slowly become lower to give a more realistic gravity effect.

If there are any replies, I will have to read them tomorrow so just know that I probably won’t be able to respond. Sorry about that, something came up.

Why would you be setting the PBT's PrimaryPart to the Player’s Character? I feel like that could be the root cause of it, especially from the video the Ball seems to be moving in the opposite direction the moment you quickly turn back

Another possible assumption is that the Ball isn’t facing the right direction in relation with its Vector3 properties, but I highly doubt that’d be the case here

The script looks fine overall, it might just be something with having to do with configuring the VectorForce a bit or something

I got some time so I completely agree with you but I am just confused when you say I am setting the primary part to be the character. Do you mean when I am setting its CFrame or its NetworkOwner or setting the character as the new PrimaryPart (I dont think I set it’s PrimaryPart to be the character)?

image

Technically a part of the Character, I mean

It may also depend on when you’re calling the action to shoot the Ball whenever it’s activated, and it might just be physics messing around for all that we know about

And 1 additional thing here I might suggest:

Don’t use a while wait(.01) do loop, as that’ll run forever & it’ll cluster your entire script performance I believe with different individual threads that are still running

About that, aren’t I just setting the CFrame to be the same as the HumanoidRootPart? I don’t think I am setting it to be part of it unless there is something about that I have missed.

And for the loop, I forgot to add a piece of code that breaks the loop when the ball gets destroyed since I wasn’t finished entirely with the code because I got stuck on that physics problem. Anyways, thanks for the suggestions! I will try them out tomorrow and keep you updated.

probably the VectorForce is relative to the attachment. Set it relative to World

2 Likes

This worked! Thank you so much!