• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

3D Lingo: key control of camera view

Hi expert folks,

I want the following interaction in a movie:

The default view in a w3d world is, say view #1. Whenever the user presses the command/ctrl key, the camera view changed to view #2;  when the key is released within one second, the view changes back to view #1. But if the user keeps the key pressed, the view automatically changes back to the default view after one second.

Thanks.

idOle
0
idOle
Asked:
idOle
  • 2
1 Solution
 
MediaMacrosCommented:
Use a keyDown script and a timer.  Basically a movie script like this...

global gTimer

on keyDown me
  if the key = "2" then
    --swap your camera
    --set a timer value
    gTimer = the milliseconds
  end if
end

on keyUp me
  if the key = "2" then
    --it was released so set it back to camera 1
    gTimer = 0
  end if
end


Then you can either use a timeout object to track the time or use an exitFrame script like this...

on exitFrame me
  if gTimer = 0 then exit
  if gTimer + (1000 * 60) < the milliseconds then
    gTimer = 0
    --set it back to camera 1
  end if
end
0
 
idOleAuthor Commented:
I am not sure I am right but this seems not working for me. The problem is whenever the "ctrl" key is pressed, gTimer keeps updating to the milliseconds on "on Keydown" handler, instead of just being set once.

Any insights? Thanks.

idOle
0
 
MediaMacrosCommented:
Well this is pseudo-code, not totally written for your use.  Instead of key 2 look for the controlDown to see if ctrl is clicked.  
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now