#Hands

1 messages · Page 1 of 1 (latest)

proud wedge
#

shocking title i know right, well im trying to recreate the grabpack from poppy playtime and my original hand placement was by using target.hit, however im thinking of switching to raycasting instead because i want to achieve this (in the video) where the hands travel a small distance between returning immediately. I just want to know how i would best achieve my desired results?

modest flume
proud wedge
#

i thought of that, but can you not set a distance for the raycast?

modest flume
proud wedge
#
local Workspace = game:GetService("Workspace")

local function castRay()
    -- The origin point of the ray
    local originPosition = Vector3.new(0, 50, 0)
    -- The direction the ray is cast in
    local direction = -Vector3.yAxis
    -- The maximum distance of the ray
    local distance = 50

    -- Cast the ray and create a visualization of it
    local raycastResult = Workspace:Raycast(originPosition, direction * distance)

    if raycastResult then
        -- Print all properties of the RaycastResult if it exists
        print(`Ray intersected with: {raycastResult.Instance:GetFullName()}`)
        print(`Intersection position: {raycastResult.Position}`)
        print(`Distance between ray origin and result: {raycastResult.Distance}`)
        print(`The normal vector of the intersected face: {raycastResult.Normal}`)
        print(`Material hit: {raycastResult.Material.Name}`)
    else
        print("Nothing was hit")
    end
end

-- Continually cast a ray every 2 seconds
while true do
    castRay()
    task.wait(2)
end
``` here is documented code
#

im not sure if it helps my case but i used this example to give distance to raycasts in past projects

modest flume
proud wedge
#

this is from roblox documentary

#

not my cxode

modest flume
#

i see

proud wedge
modest flume
proud wedge
#

yes, it ends after 50 studs

#

im not sure if i can get the cframe from that though

modest flume
#

Did some research and i think this might be it.

#

Im not really good at math so idk if it will work flawlessly but its worth a try i think

proud wedge
#

yeah i expected that

#

ill try to change it when i have the time

modest flume
#

👍

bleak sierra
proud wedge
proud wedge
#

I take inspiration from this game, i noticed that the guns follow the hand until it returns, however the guns are both a singular meshpart with bones and joints. how would i do this?

bleak sierra
#

like if ray.result = nil

narrow hollow
#

i can elaborate more when i'm on pc later, it's kind of limiting to do research on my phone

proud wedge
#

Im currently trying lerp and spring, the result i wanted wasnt nice enough and im using a viewmodel so the position changes alot. Lerp is a bit difficult for me since im not sure how i can do it perfectly i guess

narrow hollow
#

alright

proud wedge
#

@narrow hollow could you ping me when your on pc? I have this problem and im not sure hwo to fix it

proud wedge
# narrow hollow whats the issue?

I used the cframe of the hand instead of the start frame so it looked weird, but my problem is I'm not sure how I can make the guns look at the hands, I use joints because it's a meshpsrt

proud wedge
#

im not sure if its a joint problem or something but yeah