mozilla :: #introduction

18 Apr 2017
16:50jamie_anyone around that i can ponder with a question?
16:50mbrubeckjamie_: go for it
16:52jamie_so right now im playing with some 3d rendering, right now the code im working with is https://pastebin.mozilla.org/9019332 now im trying to get lines 4-13 to work (obviously does not as camera.position.y is a local var to the render loop) any ideas on how to directly modify the value of camera.position.y? the event listener needs to be outside of the loop but the function it needs cannot be local so also has to be outside of the loop
16:54jamie_which makes it challenging to modify, now if i assign say var x = camera.postion.y yes... it does pull it but it does not push it back into camera.position.y
16:59jamie_whoops https://pastebin.mozilla.org/9019333
16:59jamie_thats correct... the other one has a slight diff but not what im working with
17:00mbrubeckWhy does this have `====` instead of `=` on line 9?
17:01jamie_not sure... probably me being half asleep last night XD
17:01jamie_ignore lol
17:02mbrubeckas far as I can tell it should work if you change it to `=`
17:04jamie_oh... thought it would not be able to modify a local var...
17:04jamie_camera.postion.y is local to the renderloop
17:04mbrubeckfunctions in JavaScript are closures - they can access variables from the scope where the function is defined.
17:05jamie_hrm... works thanks... sometimes my brain forgets how to work...
17:05jamie_other than for some odd reason every key is outputing charcode 0...
17:06jamie_ill just use keycode..
17:06mbrubeckjamie_: I think charcode is only set during "keypress" events, not "keydown"
17:07mbrubeckJS key events are kind of a mess :)
17:07jamie_yeah i know....
17:07jamie_its easier to do 3d rendering than deal with keyboard events...
17:08mbrubeckha
17:11jamie_sad part is mbrubeck that i just built all that and now i realize i need to use a different physics engine... because gravity is overkill and unrealisitic on this one...
17:13jamie_firebot: pewpew
17:13* firebot Firebots been hit! BOT DOWN BOT DOWN!
17:14jamie_whelp i guess that is an escapade for a different day... gotta go get ready for work, thanks for helping me with fixing my brainfart
19 Apr 2017
No messages
   
Last message: 69 days and 14 hours ago