Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name: Password:
Ambiera Forum > CopperCube > Programming and Scripting
Author Text

2022-04-14 03:53:27

Super strange situation I just dont know why, but when switching camera's from FPS camera to simple camera (to move the mouse) - some parts of my main game Behavior (attached to FPS camera) stop working while other parts continue as normal.

In this situation the "prototype.onKeyEvent" no longer works but other code like every 1000ms continues to work and it seems the "prototype.onMouseEvent" no longer works also in this situation..... super weird....

I have had to create a separate controls input Behavior and not include that code into my main game Behavior and not attach this Behavior to my FPS camera (as before) but to another fixed node instead.

Note its not a matter the main Behavior stopping under the FPS camera when switching cameras as the code was confirmed to continue running when doing this.....

any ideas why ???

2022-04-14 04:21:10

Are you using ccbGetActiveCamera() for the rest of the code other than inputEvents?

I too had some sort of issue when switching the camera from simple to FPS, it happens when you have a simple camera selected as an active camera at the beginning of your scene. and when you change it to FPS camera, it breaks most of the game.
In order to fix this issue. Make your FPS camera as the active camera when the scene starts.
and change it to the simple camera using before first drawing do something behavior.
and it will fix the issue.

I don't know which one is the active camera in your game when the scene starts. but that's the case with one of my project and that's how I fix it.

Hope this is the same case with you too and you will be able to fix it by the same method. As you are using custom code, I can't really say much, if there is something in your code if that's causing the issue.

2022-04-14 06:20:43

Yeah thanks 'just_in_case' - I actually dont use "ccbGetActiveCamera()" in my code anywhere and its not a problem on load as my main FPS camera always loads and runs on start fine anyway.

Its only when I switch from main FPS camera to simple camera for use of the mouse in my game menus and then switch back when finished and ready to continue moving around the world.

I have checked my code and cant see any problems the way I had it before but can confirm its been a very long standing problem of getting any adjustable (user defined) keyboard inputs to work while in the simple camera and menus unless using the fixed default CC "when a key is pressed" behaviors which always work but anyways since I now have a separate Behavior for all keyboard inputs works in every situation....super weird but thats what I had to do...

I have it such that any key can be changed and updated to work in my game from the 'Keyboard' scene including walking and running etc...

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Int?rnational" (you are not logged in)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



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