I’m trying to visualize a raycasted projectile on the client before it is fired, but the direction variable is behaving super weird. It changes drastically when I start moving. Server-side uses the same code and it’s perfectly fine. Any clue why this is happening?
Hello, it looks as though your visual displays the negative of the player’s velocity, without the trajectory of the bullet being calculated. Is the code snippet you displayed above the only thing that factors into the equation?
It is, yes. I later use the direction variable in a raycast: workspace:Raycast(StartPosition, Direction * BulletTravelDistance, Params)
Only the player character is in the Params variable.
Playing around with some print statements, the start and end positions are logical when moving around, but when calculating the vector (EndPosition - StartPosition), that’s when it goes wild (i.e the X value goes from 0.26 to something like -0.98).
You could possibly use the Humanoid’s Velocity to offset the ray cast?
I’m not sure what’s causing your vector to point in that direction as your code seems sound enough.
