You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m working on a basic VR game using the Nexus VR character model. However, I’ve run into an issue.
I’m using tools to implement a pickup system as creating a system most other ways has proven to be incredibly difficult to use and very buggy. However, if anyone knows of a tutorial on how to implement a better system, PLEASE direct me towards that.
The problem: I’d like to have the tools carry their velocity from being held to being released. This is so that when you let go of a tool, it carries it’s velocity and can be thrown. Here’s my current setup, using some code to get velocity from a dev forum post.
local tool = script.Parent
local handle = tool.Handle
local RunService = game:GetService("RunService")
local RATE_PER_SECOND = 2
local part = handle
local previousPartPosition = part.Position
RunService.Heartbeat:Connect(function(dt)
local displacement = part.Position - previousPartPosition
toolvelocity = displacement/dt -- your part velocity
previousPartPosition = part.Position
end)
tool.Unequipped:Connect(function()
wait(0)
tool.Parent = workspace
tool.Handle.CanTouch = false
wait(1)
tool.Handle.CanTouch = true
wait()
local newvel = toolvelocity * 5000000000000 --this multiplier is only this absurdly high so that i can tell if velocity is correctly applied, it will be lowered once i get this working.
print(newvel)
handle:ApplyImpulse(newvel)
end)
However, the tool just drops to the floor without gaining any velocity. The print(newvel) is printing out the right number, so why is this not working?