#Custom Autojump for Voxels

1 messages · Page 1 of 1 (latest)

still turtle
#

Now the reason for why I say it is a custom autojump is because the player is not actively "jumping," but rather, teleporting upward. Rather than applying an upward force to get them on top of the object.

#

Some case notes behind what I am concerned with:

  1. player stops moving directly in front of the cube. Causing them to go in an infinite loop of teleporting up, falling down, and the raycast returning true again thus causing them to teleport back up. Over and over again.
#
  1. playing not being able to jump up the corresponding block due to height
#

I have a few theories already on how to get 1 to potentially work, and it is by making the player ever so slightly closer to the Block. Small enough that it is unnoticeable, but big enough to make the player climb on top of the Block.

sick parcel
still turtle
sick parcel
still turtle
sick parcel
#

Basically firing raycast from player, and checking if theres a part in front then tping them above the part

still turtle
#

Yeah I took a closer look and yeah xd

#

0 code.

Roblox's hip height automatically adjusting the model

sick parcel
#

what about this

#

oh

still turtle
#

I think what I'm going to try doing is doing the same thing you are doing right now, but then apply the check after.

sick parcel
#

you want auto jump for small parts right?

still turtle
#

ahaha..

still turtle
# still turtle

at the start there you see him automatically 'climb' up the block (of course he jumps after 😔)

#

at around 0:02

sick parcel
#

Customize the values

#

wait i gotta fix something

#
local runService = game:GetService("RunService")
local character = script.Parent

local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local humanoid:Humanoid = character:WaitForChild("Humanoid")

humanoid.AutoJumpEnabled = false

local maxAutoJumpDistance = 2
local rayCastDetectionDistance = 1
local jumpDistance = 1

runService.Heartbeat:Connect(function(_delta)
    local origin = humanoidRootPart.Position - Vector3.new(0,2,0)
    local direction = humanoidRootPart.CFrame.LookVector * rayCastDetectionDistance
    
    local raycastParams = RaycastParams.new()
    raycastParams.FilterType = Enum.RaycastFilterType.Exclude
    raycastParams.FilterDescendantsInstances = character:GetDescendants()
    
    local result = workspace:Raycast(origin, direction, raycastParams)
    if result then
        local instance = result.Instance
        local position = result.Position
        
        local fixedSize = (instance.Size-position)
        if fixedSize.Y > maxAutoJumpDistance then return end
        
        local newDirection = humanoidRootPart.CFrame + (humanoidRootPart.CFrame.LookVector * jumpDistance)
        humanoidRootPart.CFrame = newDirection
    end
end)
still turtle
#

Well

#

That's certainly interesting

#

evidently it doesnt work with my character

#

and im kind of tired to know why xD

sick parcel
#

Does your character have humanoidRootPart and humanoid?

still turtle
#

yeup

#

1s im going to try it myself

#

:[

#

runservice.heartbeat isnt firing

#

LOL

#

holdup i have an idea

sick parcel
#

bruv

sick parcel
# sick parcel

btw to get result like this u can try these vals

local maxAutoJumpDistance = 2
local rayCastDetectionDistance = 2
local jumpDistance = .5
still turtle
#

nvm I got it xd

#

i had the script in wrong area

#

haha

#

i got mine to work

#

but holy its so buggy

#

xD

sick parcel
#

huh how?

still turtle
#

eeeeeh funny

#

ill try out yours now

#

Yeah it doesnt work on the 4x4x4's

#

but it works for the 3^3

sick parcel
#

maxAutoJumpDistance

still turtle
sick parcel
#

if you wanna make your character jump big blocks then increase this variable's value

still turtle
sick parcel
#

i mean the land is a single mesh?

still turtle
#

of blocks

sick parcel
#

just play with the values

still turtle
#

unfortunately no matter what i do it doesnt change

sick parcel
#

weird

still turtle
#

Got it to work

#
local runService = game:GetService("RunService")
local character = script.Parent

local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local humanoid:Humanoid = character:WaitForChild("Humanoid")

humanoid.AutoJumpEnabled = false

local maxAutoJumpDistance = 4
local rayCastDetectionDistance = 1
local jumpDistance = 1

runService.Heartbeat:Connect(function(_delta)
    local origin = humanoidRootPart.Position - Vector3.new(0,2,0)
    local direction = humanoidRootPart.CFrame.LookVector * rayCastDetectionDistance

    local raycastParams = RaycastParams.new()
    raycastParams.FilterType = Enum.RaycastFilterType.Exclude
    raycastParams.FilterDescendantsInstances = character:GetDescendants()

    local result = workspace:Raycast(origin, direction, raycastParams)
    if result then
        local instance = result.Instance
        local position = result.Position

        local fixedSize = (instance.Size-position)
        if fixedSize.Y > maxAutoJumpDistance then return end

        local newDirection = humanoidRootPart.CFrame + Vector3.new(0, instance.Size.X, 0) + (humanoidRootPart.CFrame.LookVector * jumpDistance)
        humanoidRootPart.CFrame = newDirection
    end
end)```
#

Changed newdirection to include a vector that changes

#

it still bugs out though LMAO

sick parcel
#

replace instance.Size.X with fixedSize.Y

still turtle
#

it bugs worse still

#

lol

plush scarab
#

make use of wedges ig

plush scarab
#

after doing that its pretty smooth

#

the "lag" you see when teleporting is the result of the camera

still turtle
still turtle
#

@plush scarab

#

@sick parcel

sick parcel
#

nice

still turtle
#

it is called voxel stepping

#

not autojump

#

Also the video is not what im wanting