Ambiera ForumDiscussions, Help and Support. |
|
[ 1 2 ] Page 1 of 2 |
|
|||||
|
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. ![]() 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. ![]() |
||||
|
i'd help you but your post is confusing af |
||||
|
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) thanks ![]() |
||||
|
Nah fckd up my script nothing works now ![]() 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. ![]() |
||||
|
this might help you: https://hadoken-records.itch.io/... |
||||
|
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. |
||||
|
so you just need an action to move to a position over time? |
||||
|
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.... |
||||
|
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. |
||||
|
https://files.catbox.moe/gd4hxy.... Thanks for the link dude ! This will help. ![]() |
||||
|
Hi there coltatica |
||||
|
Sikes wrote: Hi there coltatica Hi there friend ! |
||||
|
Are you working on a game? ![]() |
||||
|
Sikes wrote: Are you working on a game? ![]() 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. |
||||
|
I'm glad that this is a case, which engine are you using for the first game |
[ 1 2 ] Page 1 of 2 |
|