alliancer
|
  |
| Joined: 18 Mar 2013 |
| Total Posts: 1016 |
|
|
| 16 Mar 2017 11:01 AM |
https://www.roblox.com/games/625364452/Nerf-FPS-2017-OPEN-ALPHA#!
The game forces first person and has arms(+gun) that smoothly follow your camera with a tiny delay. How did they do this? I assume it's something local because I can't see other players arms |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2017 11:04 AM |
| do you know how any FPS games are made? |
|
|
| Report Abuse |
|
|
alliancer
|
  |
| Joined: 18 Mar 2013 |
| Total Posts: 1016 |
|
| |
|
|
| 16 Mar 2017 11:19 AM |
"The game forces first person and has arms(+gun) that smoothly follow your camera with a tiny delay. How did they do this? I assume it's something local because I can't see other players arms"
for first person force: http://wiki.roblox.com/index.php?title=API:Class/Player/CameraMode
the arms are usually fake arms that are welded to the torso/head/other part, and u use fake arms so that you can weld them easily and so that the player can view them in first person
if only the client can view its own arms, then it's because Filtering Enabled is on and the arms and welds were created through localscript so they are not replicated to the server
the tiny delay is due to how the arms are rotated with the camera - the creator made some sort of cframe tweening for the arms to lag like they do
if you need any clarification just ask, that's the best summary I could make |
|
|
| Report Abuse |
|
|
alliancer
|
  |
| Joined: 18 Mar 2013 |
| Total Posts: 1016 |
|
|
| 16 Mar 2017 11:24 AM |
| Thanks, this helps. I'm interested in the arms lagging behind the camera, is CFrame tweening the only way this can be done? how would I create it? |
|
|
| Report Abuse |
|
|
VoidFrost
|
  |
| Joined: 14 Oct 2011 |
| Total Posts: 1188 |
|
|
| 16 Mar 2017 11:31 AM |
Have you even seen phantom forces? Also while being in the game I noticed that they have utlized this easing method. It is done in-game when people move their camera, the arms sort of flop realistically.
http://wiki.roblox.com/index.php?title=Springs |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2017 11:31 AM |
well the creator probably made a function that works like the GUI tweening functions that you can use on ROBLOX
so it was probably something like this:
local tweencounter = 0--use this so tweens don't overlap
function tweenTo(goalcframe) --creator also could have had additional arguments local thistween = tweencounter local startcframe = arms.CFrame
local percent = 0 while thistween == tweencounter do --make sure the camera hasn't moved percent = percent+10/100 arms.CFrame = startcframe:lerp(goalcframe, percent) wait() end end
camera.Changed:connect(function(prop) if prop == "CFrame" then tweenTo(camera.CFrame) end end)
that's some pretty rough code with plenty of undefined variables and simplifications, but hopefully that gives you some idea |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2017 11:33 AM |
my utilisation of lerp would create a linear movement - of course, there's plenty of different lerping/easing methods that you could use to create your desired effect
i was just trying to give you a rough idea of how it was done
also, i completely forgot to use tweencounter, I'd probably add one to it everytime I called tweenTo(), to cut off the previous tween |
|
|
| Report Abuse |
|
|
alliancer
|
  |
| Joined: 18 Mar 2013 |
| Total Posts: 1016 |
|
|
| 16 Mar 2017 11:36 AM |
| Thanks a bunch you guys. appreciate the help, I'll be able to handle it from here :) |
|
|
| Report Abuse |
|
|