Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
How To Set Vertical Camera Limitation

Registered User
2022-03-29 07:16:22

I'm new user of this engine. id love to trial error with this engine just because only this engine did good (no bugs/problems) when i created and show in webgl on browser rather then others with bugs. Also i tried with android phone (inside apk) and its still have a fast and good performance. Congratulations!

But i need help about camera setting

I opened a tank scene file that used a model viewer camera type. I need solution how to set this camera not to move below the floor node.

I used an "If below the sea level do something" behaviour to detect camera position, but how to stop the camera node not to go below the sea level?

Maybe there is a script anyone know how. I dont want to see below the 3d object, i just need to rotate left right up and down but not below the floor/sea level

i plan to change the tank object with my gltf house so i dont want to sea below the house just limit above the road.


Registered User
2022-03-29 09:33:23

there is many ways how to do it..

this version i made checks if camY is lower than camTargetY
(you can adjust it -but make sure your cam pos is not in block zone at startup)

Download project file with script i made.

Script itself:
//Script by sven from ambiera forum.
//for more stuff visit my youtube channel:
//also visit my itch page:

<behavior jsname="behavior_C_L" description="CL">
<property name="Cam" type="scenenode" default="Camera1" />
<property name="AdjustH" type="int" default="20" />

behavior_C_L = function()

behavior_C_L.prototype.onAnimate = function()
var clevel = ccbGetSceneNodeProperty(this.Cam, "Position");
var tlevel = ccbGetSceneNodeProperty(this.Cam, "Target");

ccbSetSceneNodeProperty(this.Cam, "Position",clevel);
return true;

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Internati?nal" (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© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact