generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Camera Lerp Question

Previous Thread :: Next Thread 
Lurching_Spark is not online. Lurching_Spark
Joined: 01 Oct 2016
Total Posts: 255
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
LifeInDevelopment is not online. LifeInDevelopment
Joined: 10 Nov 2015
Total Posts: 670
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
Lurching_Spark is not online. Lurching_Spark
Joined: 01 Oct 2016
Total Posts: 255
01 Jan 2017 11:32 AM
oh ok, that makes more sense, I'll try that.
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
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
LifeInDevelopment is not online. LifeInDevelopment
Joined: 10 Nov 2015
Total Posts: 670
01 Jan 2017 12:05 PM
He said interpolating doesn't work for him.
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
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
lua_pointer is not online. lua_pointer
Joined: 15 Oct 2016
Total Posts: 179
01 Jan 2017 12:38 PM
Ultimate is ignorant, pre-built isn't always better. ROBLOX interpolation methods are horrendous.
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
01 Jan 2017 12:46 PM
^ No need to be rude to your colleagues.


http://wiki.roblox.com
Report Abuse
KapKing47 is not online. 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
Lurching_Spark is not online. Lurching_Spark
Joined: 01 Oct 2016
Total Posts: 255
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
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
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
Lurching_Spark is not online. Lurching_Spark
Joined: 01 Oct 2016
Total Posts: 255
01 Jan 2017 04:43 PM
oh, ok good to know. Thanks Raheem.
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image