#Help needed with Physics

1 messages · Page 1 of 1 (latest)

prisma heron
#

The knife's spin is going horizontally instead of vertically down, and it looks botched, help would be great!
Physic Properties:

local GRAVITY_MULT      = 0.4       -- 0 = no gravity, 1 = full gravity; try 0.4–0.6
local THROW_WINDUP_MIN  = 0.18        -- minimum delay before spawning the knife
local THROW_WINDUP_MAX  = 0.30        -- cap on windup wait (in case anim is long)
local DESPAWN_TIME      = 12          -- seconds before knife cleans up if it misses
local SPIN_ANGVEL       = 10           -- set >0 to spin: e.g., 40```

    -- Initial forward velocity (slower than before)
    knife.AssemblyLinearVelocity = dir * THROW_SPEED
    if SPIN_ANGVEL > 0 then
        knife.AssemblyAngularVelocity = dir * SPIN_ANGVEL
    end

    -- Dampen gravity so it flies farther without cranking speed
    -- We apply an upward VectorForce equal to (1 - GRAVITY_MULT) * (mass * g)
    local att = Instance.new("Attachment")
    att.Name = "KnifeCenter"
    att.Parent = knife

    local vf = Instance.new("VectorForce")
    vf.Attachment0 = att
    vf.ApplyAtCenterOfMass = true
    vf.RelativeTo = Enum.ActuatorRelativeTo.World
    vf.Force = Vector3.new(0, knife.AssemblyMass * workspace.Gravity * (1 - GRAVITY_MULT), 0)
    vf.Parent = knife