Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
how can i change the pov of the fps camera if the right mouse button is pressed? |
||||
|
You can do: Behaviours triggered by events >When a key is pressed do something >Execute JavaScript Configure like so Key pressed: Right Mouse Button Action: Key Pressed Down And then enter: ccbSetSceneNodeProperty(Camera1, "FieldOfView_degrees", 4); Then, add a second one configured like the one above, except change the action to Key Left Up. Then enter: ccbSetSceneNodeProperty(Camera1, "FieldOfView_degrees", 72); Of course, you can modify the FOV values to your liking. And in fact, there's a demonstration .CCB file on another thread that talks about an issue similar to the one you're having. https://ambiera.com/forum.php?t=... Hope this helps! |
||||
|
I just noticed - I make a small mistake 'FieldOfView_Degrees' - the D should be capitalized... |
||||
|
it says my camera is not defined. i have a camera called Camera2 so i changed camera1 to camera2 but it says it is not defined. i can show you a clip if that is needed. thanks |
||||
|
emma wrote: it says my camera is not defined. i have a camera called Camera2 so i changed camera1 to camera2 but it says it is not defined. i can show you a clip if that is needed. thanks Try renaming the camera to "Camera1", not "camera1". The object name and the call from the code need to match exactly. |
||||
|
https://www.mediafire.com/file/dg4t6fmi2q69ed3/2021-03-27_10-48-58.mp4/file that the clip |
||||
|
actually, the above code provided by @outlawsoftware is not the complete code. the whole code should go like this.
the above code deals with whatever camera in your scene is Active, you can change the value "4" to your desired value which fits perfect for you. by default coppercube uses a value of "72" here is another piece of code if you don't want to do it with the active camera but instead want to do it with a specific camera.
here change the "Camera1" with the name of your camera, which you want to change the field of view. and the value "4" goes the same as the above code. |
|