Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
change pov / aim if a button pressed

emma
Guest
Quote
2021-03-26 19:17:22

how can i change the pov of the fps camera if the right mouse button is pressed?


outlawsoftware
Registered User
Quote
2021-03-27 01:03:04

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!


count2rfeit
Registered User
Quote
2021-03-27 03:25:28

I just noticed - I make a small mistake

'FieldOfView_Degrees' - the D should be capitalized...


emma
Guest
Quote
2021-03-27 11:29:55

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


VP
Guest
Quote
2021-03-27 11:46:38

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.


emma
Guest
Quote
2021-03-27 11:51:45

https://www.mediafire.com/file/dg4t6fmi2q69ed3/2021-03-27_10-48-58.mp4/file that the clip


just_in_case
Moderator
Quote
2021-03-27 13:48:00

actually, the above code provided by @outlawsoftware is not the complete code.

the whole code should go like this.

var camera = ccbGetActiveCamera();
ccbSetSceneNodeProperty(camera, "FieldOfView_degrees", 4);


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.


var camera = ccbGetSceneNodeFromName("Camera1");
ccbSetSceneNodeProperty(camera, "FieldOfView_degrees", 4);


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.





Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internation?l" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact