ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Recreate the action
person icon
coltatica
Registered User
Quote
2025-05-30 20:02:56

Hello everyone, I’m new to CopperCube. I have some experience with JavaScript, but not in video game development or object-oriented programming.

I tried searching the forum using different keywords, but I couldn’t find anything on this topic. So I apologize if this has already been discussed here.emoji icon_sad

My request is quite simple: I would like to recreate the action "Change position of a scene node" in a much simpler way, adapted to my project. What interests me in the parameters of this action are:

Set position type: Move by a vector

Vector: 0,0,0 (xyz)

Move animated: Boolean

Time to move (ms)

I looked at the documentation and found this:

Would this correspond to a "Move animated"?

javascript
ccbSetPhysicsVelocity(sceneNode, x, y, z);
Note: This function is not available in the editor. Sets the linear velocity of an object simulated by the physics engine. This only works when physics simulation is turned on and available for the current platform.

Parameters:

sceneNode: The node this is applied to. The node needs either a "collide when moved" or an "object moved by physics engine" behavior attached to it in order to work.

x, y, z: Velocity.

And for the vector, I think this is the correct approach?

javascript
vector3d()
vector3d(x, y, z)
A class for holding three float coordinates - x, y, and z. It also provides helper methods:

add(), subtract(): Addition and subtraction of vectors

getLength(): Calculates the length

normalize(): Makes the vector length equal to 1

String conversion

Examples:

javascript
var v = new vector3d(0, 0, 0);
print(v);
(prints (0, 0, 0))

javascript
var v1 = new vector3d(10, 0, 0);
var v2 = new vector3d(0, 20, 0);
var v3 = v1.add(v2);

v3.normalize();
print(v3 + " Length:" + v3.getLength());
(prints (0.447214, 0.894427, 0) Length: 1)

If someone has the complete code, I’d love to take a look at it.emoji icon_happy

person icon
guest
Guest
Quote
2025-05-31 00:54:04

i'd help you but your post is confusing af

person icon
coltatica
Registered User
Quote
2025-05-31 04:24:01

I get it for the vector, but now how to move the node slowly from point a to b without teleporting itself (move animated time to move) thanksemoji icon_smile

person icon
coltatica
Registered User
Quote
2025-05-31 08:16:09

Nah fckd up my script nothing works now emoji icon_cry pulled my hair off...

Oh and sorry if i was not specific enought, let me be clear.

If someone can explain me with simple examples how you could achieve a scripted action to do the exact same thing as the ccb native one called "Change position of a scene node" but for these parameters only:

Set position type: Move by a vector

Vector: 0,0,0

Move animated: true

Time to move (ms)

Thank you in advance, have a nice day guys.emoji icon_smile

person icon
guest_guest
Guest
Quote
2025-05-31 10:27:23

this might help you:

https://hadoken-records.itch.io/...

person icon
coltatica
Registered User
Quote
2025-05-31 10:48:49

Thanks, based on the description it might help even if i'm not 100% sure the extension is not expensive so i'll give it a try.

person icon
guest
Guest
Quote
2025-05-31 19:00:40

so you just need an action to move to a position over time?

person icon
guest
Guest
Quote
2025-05-31 19:37:19

here's a code example of how to do it. i had AI comment it. if you need to turn it into an action, i can do that if you want. the thing with the action is you need to register and unregister a frame event. the fade screen action gives you an example of doing that.

https://files.catbox.moe/gd4hxy....

person icon
coltatica
Registered User
Quote
2025-05-31 19:43:17

I needed the whole javascript code of the ccb native action "Change position of a scene node" but I figured it out thanks, take some time though lol.

person icon
coltatica
Registered User
Quote
2025-05-31 19:53:15

https://files.catbox.moe/gd4hxy....

Thanks for the link dude ! This will help.emoji icon_smile

person icon
Sikes
Guest
Quote
2025-06-01 00:03:09

Hi there coltatica

person icon
coltatica
Registered User
Quote
2025-06-01 11:04:32

Sikes wrote:
Hi there coltatica


Hi there friend !

person icon
Sikes
Guest
Quote
2025-06-01 11:05:29

Are you working on a game?emoji icon_smile

person icon
coltatica
Registered User
Quote
2025-06-01 11:10:19

Sikes wrote:
Are you working on a game?emoji icon_smile


I'm laying the foundations for a second game with plugins that will make future tasks easier in coppercube. I'm currently finishing my first game, but on a different engine. After that, I plan to use only coppercube for my future projects.

person icon
sikes
Guest
Quote
2025-06-01 19:57:27

I'm glad that this is a case, which engine are you using for the first game


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 |