|
| 04 Mar 2015 11:03 AM |
How would I run a function using CurrentCamera.Changed even when the angle of the camera changes? Currently, this doesnt fire .Changed when the angle is changed. Any solutions?
Offer on R$2,109 and send on 21,112 RAP |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:11 AM |
| Unfortunately, you will probably need to monitor changes yourself. Changes made by internal Roblox stuff doesn't seem to fire Changed. Examples of this include parts velocity/position changing due to physics, unmodified camera rotating, character walking, et cetera. |
|
|
| Report Abuse |
|
|
nomer888
|
  |
| Joined: 13 Feb 2010 |
| Total Posts: 551 |
|
|
| 04 Mar 2015 11:15 AM |
You could create a while loop checking if the camera's CoordinateFrame changed. Here's some pseudocode:
local function Changed() -- Do stuff here. end
local lastFrame = currentCamera.CoordinateFrame local currentFrame while RenderStepped:wait() do currentFrame = currentCamera.CoordinateFrame if (currentFrame ~= lastFrame) then lastFrame = currentFrame Changed() end end |
|
|
| Report Abuse |
|
|
nomer888
|
  |
| Joined: 13 Feb 2010 |
| Total Posts: 551 |
|
|
| 04 Mar 2015 11:20 AM |
Nevermind, apparently the :wait() method in events does not return something that is not nil.
Replace 'while RenderStepped:wait() do' with:
while true do -- Everything that was here before. RenderStepped:wait() end |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:26 AM |
| The wait method in events returns the event parameters. So if you were doing PlayerAdded:wait() it would return the player. |
|
|
| Report Abuse |
|
|
nomer888
|
  |
| Joined: 13 Feb 2010 |
| Total Posts: 551 |
|
|
| 04 Mar 2015 11:28 AM |
| Oh, I didn't know that. Thanks for pointing that out! |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:54 AM |
The problem is that RenderStepped causes lag issues, so I dont want to use it. I currently have been, though.
Offer on R$2,109 and send on 21,091 RAP |
|
|
| Report Abuse |
|
|