I’m trying to replicate a system where your arm streches to act as a first person viewmodel, the game “a dusty trip” uses a system similar to this to handle grabbing items or using the steering wheel on vehicles.
Although I have no idea how to achieve this.
video referance:
2 Likes
awry_y
(Charlotte)
July 18, 2024, 5:01am
#2
Just use a viewportmodel with a very long arm.
1 Like
ZunerDev
(Zuner)
December 10, 2024, 5:19pm
#3
Hello! I made a copy of this system a few months ago, I used CFrame.lookAt and a bit of math, here’s code:
local pos1 = self.ArmAttachment.WorldPosition
local pos2 = self.Object.CFrame:ToWorldSpace(self.Offset).Position
self.Arm.Size = Vector3.new(Constants.ARM_SIZE, Constants.ARM_SIZE, (pos2 - pos1).Magnitude + 1)
self.Arm.CFrame = CFrame.lookAt((pos1 + pos2) / 2, pos2)
You can see my code and download uncopylocked .rbxl place in the link, I’ll attach it below.
local Players = game:GetService('Players')
local RunService = game:GetService('RunService')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Constants = require(ReplicatedStorage.Services.InteractService.CONSTANTS)
local Maid = require(ReplicatedStorage.Modules.Maid)
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local Camera = workspace.CurrentCamera
local ArmService = {}
ArmService.__index = ArmService
function ArmService.new(object: BasePart)
local self = setmetatable({}, ArmService)
self.Maid = Maid.new()
self.Object = object
self.Character = Player.Character
This file has been truncated. show original