Having difficult smoothing the directional positioning of my moving part along a path

hey, i’m having some issues with trying to smooth out the positioning of my moving part. i’ve got it working fairly well now with little to no issues. my only thing is that is isn’t s smooth as i’d like it to be. there is some small bouncing involved.

i’m not sure exactly what would be causing this.

scenario explanation:
i have a target (player’s character’s root part) that is moving

i have a ball that is moving.

i don’t want the ball to go into certain parts. i want it to go around the parts (which is currently does).

logic:
i am getting the direction from moving ball position to the target position

i am using raycast to check if there are any parts infront of the direction

if there is a raycast result i am getting a 90 degree point from the ball’s position to the raycast result’s position. i’m deciding where this point is based on the direction the ball is moving toward and i believe the direction from the center point of the map. (all this seems to be working well)

the problem: [i think the issue is my path is not at an exact straight line.
my ball is a little bouncy. which i thnik means that it is not smoothly going along the path. somewhere it think it should go to the target again maybe? then gets corrected. am not 100% sure. still testing and exploring.

please let me know if you have any suggestions.

the 90 degree point function:

local function _create90DegreePoint(position1, position2)
            local midpoint = (position1 + position2) / 2
            local degreeDirection = (position2 - position1).Unit
            local perpendicular = Vector3.new(-degreeDirection.y, degreeDirection.x, degreeDirection.z)
            local centerPartDirection = (position2 - workspace:FindFirstChild("CenterPart").Position).Unit

            local point90Degrees = midpoint + (perpendicular * 2) + (centerPartDirection * 2)
        
            return point90Degrees
        end

the final direction if result:

local pathDirection = ((currentTarget.Position + degreePoint) - originPosition).Unit

let me know if there’s any additional information that would help brainstorm a solution.

1 Like

resolved by using a different method… knowing that my planes are never on curves so my direction will always be specific i just ended up using that for raycast and did not need to create a 90 degree point. just let me new direction know not to go in an exact direction on which axis. not really the solution to this problem… but is the solution i used for my situation.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.