ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator Move Position or Change Position of Scene Node
person icon
loopsreturns
Registered User
Quote
2024-06-30 11:24:54

I have a on proximity behavior for a flat plane, and every time I want to move an camera to the same x,y but different z location, it shoots the player camera up in the air. Either with "change position of a scene node" or action "Move Position" from CC's documentation. Any way to fix the camera being shot up into the air? I think what the code is trying to do is place the camera at a position relative to the orientation and rotation of the camera, which ends up saying that x is up instead of an absolute world value to the side.

person icon
Guest
Guest
Quote
2024-06-30 11:52:21

Make sure you're setting the camera's target after moving it.

person icon
just_in_case
Moderator
Quote
2024-06-30 13:39:40

Hi, there you probably need a custom extension for that if your camera has collision enabled and if you are trying to change its position. It might do a random skydive or weird placement due to collision with the other nodes in your scene.

The inbuilt actions don't change the position without collision, I will add an option in there for future updates that there will be a checkbox that will allow you to change position without collision from the actions as well.

try using the command ccbSetSceneNodePositionWithoutCollision()

Here is the example code from the documentation, just make necessary changes to the code as per your need for example node name, and position you want to change.


var s = ccbGetSceneNodeFromName("cubeMesh1");
ccbSetSceneNodePositionWithoutCollision(s, -22.097015, 9.848448, -40.738777);


Note:- This code will be of no help if you have the physics simulation turned ON, you can either wait for an update or use my Custom Launcher to make it work with the physics simulations turned ON.


I hope this is what is causing your camera to do a skydive from a random position and will help you fix the issue.

emoji icon_holy

person icon
loopsreturns
Registered User
Quote
2024-06-30 23:52:13

What if I want to place the camera scene node without collision relative to the camera's current position???

person icon
just_in_case
Moderator
Quote
2024-07-01 16:29:45

You can use the javascript for that to get the position of the camera and then adjust it with the above code.

So the code should be something like this if you are using the Active Camera.


var cam = ccbGetActiveCamera();
var camPos = ccbGetSceneNodeProperty(cam,"Position");

ccbSetSceneNodePositionWithoutCollision(cam, camPos.x+10, camPos.y+10, camPos.z+10);


the above code will set the active camera to +10 units on each X, Y, and Z position relative to its current position.


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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