|
| 01 Jan 2017 11:09 AM |
I'm able to set the camera directly behind the player's head by doing this.
camera.CFrame = player.Character.Head.CFrame
but when i try to smooth that out with lerp it will not rotate. This is what i did.
camera.CFrame:lerp(player.Character.Head.CFrame,1000)
I tried playing around with camera.Focus and also with the Interpolate function, but I couldn't get any different results. Any tips would be appreciated :) |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:14 AM |
You use a for loop:
for i = 1, 1000 do camera.CFrame:lerp(player.Character.Head.CFrame, i) end |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:32 AM |
| oh ok, that makes more sense, I'll try that. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 11:37 AM |
*cough* http://wiki.roblox.com/index.php?title=API:Class/Camera/Interpolate *cough*
http://wiki.roblox.com r+://169950678 |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 12:05 PM |
| He said interpolating doesn't work for him. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 12:36 PM |
^ Sorry I didn't read the last part.
I tried doing interpolate once. My camera moved but I didn't have much knowledge of how it was working. Interpolation is an inbuilt function for the camera, so it should be used when manipulating the camera's position, rotation etc.
http://wiki.roblox.com |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 12:38 PM |
| Ultimate is ignorant, pre-built isn't always better. ROBLOX interpolation methods are horrendous. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 12:46 PM |
^ No need to be rude to your colleagues.
http://wiki.roblox.com |
|
|
| Report Abuse |
|
|
KapKing47
|
  |
| Joined: 09 Sep 2012 |
| Total Posts: 5522 |
|
|
| 01 Jan 2017 01:39 PM |
I wonder why Roblox's code is horrendous xD
Anyhow, that code will work, although u don't just do that, cos for each iteration it will get the NEW camera CFrame, NOT the old one, therefore it wont interpolate evenly.
local cf = camera.CFrame for i = 1, 10 do camera.CFrame = cf:lerp(player.Character.Head.CFrame, i / 10) end
|
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 04:11 PM |
Thanks everyone, i noticed that @KapKing and @LifeInDevelopment way's both look a bit different but work nicely. I ended up using this and I'm really happy with how it looks. I had to offset the head position because the view in my game is locked at 30 behind the character.
local offset = CFrame.new(0, 0, 30) for i = 1,100 do wait(.02) c.CFrame = c.CFrame:lerp(player.Character.Head.CFrame:toWorldSpace(offset), i / 100) end |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 04:36 PM |
The quickest wait time (excluding renderstepped service) is 0.3, so your wait time will just round up to 0.03
http://wiki.roblox.com |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2017 04:43 PM |
| oh, ok good to know. Thanks Raheem. |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2017 07:09 AM |
Oops I didn't mean 0.3 there, I meant 0.03. But I'm sure you knew that :)
http://wiki.roblox.com |
|
|
| Report Abuse |
|
|