ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator variable=force
person icon
spicymilk
Registered User
Quote
2023-12-22 02:30:12

I was wondering if somebody could help me with a script where whatever the variable value is the force is applied to an object on a key released

thanks

person icon
just_in_case
Moderator
Quote
2023-12-22 06:12:01

well, it depends on how you are creating your game. if you are using physics simulation then you can do .

  
var force = 10;
var cube = ccbGetSceneNodeFromName("cubeMesh1");
ccbSetPhysicsVelocity(cube, 0, 0, force);


this will apply a force of 10 on the Z axis of the cube mesh, you can change the value of force. If you want to apply force on a different side, then just replace the 0 with force variable name, and then that force will be applied on that axies too.

If you are not using the physics simulation, then you have to use the timing controls as welll, or incremention values to move the scenenode continuously untill you get to the desired value or result.

you can use the ccbSetSceneNodeProperty() command and use the "Position" or "PositionAbs" attribute to change the position of the scenenode, you can also use a lerp function to make the movement smooth so that it will look much better.

person icon
spicymilk
Registered User
Quote
2023-12-23 02:17:14

thanks I'll try this

person icon
spicymilk
Registered User
Quote
2023-12-23 02:30:09

if you were in game how would you change how much force is applied?

person icon
writer
Guest
Quote
2023-12-23 10:00:16

WHAT IS THE POWER BROTHER, THIS APPLY TO THE PHYSICAL SIMULATION AND WEIGHT OF THE OBJECT?

person icon
Guest
Guest
Quote
2023-12-23 10:38:55

@writer

No offense man, but your content is hard to read and is often seen as silly shouting on forums when you constantly write in all caps. I would imagine no one would want to help with your query with that style of question.

person icon
spicymilk
Registered User
Quote
2023-12-23 17:19:59

I get what he was saying though my bad, in the script it changes the variable so every time it's run that's how much power the cube is moved with. I'm using the physical simulation and each time I run that code, with the first line of code removed from the script it doesn't work and I can't get the variable to be changed in game and affect how far the cube is shot out.

also English isn't my first language so if any of that didn't make sense I could try to put it in a different way


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 |