Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Feature requests and bug reports
Related to water surface

behroz-khan
Registered User
Quote
2017-09-21 14:06:35

Please niko change programming of water surface, set that the player can swim in it.


blackwater
Registered User
Quote
2017-09-21 17:32:59

Hey, it is possible already, but not as easy as checking a checkbox.
Basicly it functions like this:
------------------------------------
You need to use variables that you define yourself, (I put these in the scene-name-node - on top in your scenegraph explorer window).:
When the game starts: earth=1, water=0 (swim=0)
Set a behaviour on the waternode that checks if the player is in proximity of the waternode. If so, then change the variable "water" to 1 and "earth" to 0.

You also need to set up a behaviour "every few seconds to something", for example in the same scene-name-node.
So, after x ms, if checks if water=1, and if it does, it changes the active animation (to swimming/floating) for the player if the variable "water"=1.

Also, of course you'll need to do the reverse - if the player leaves the water for ground - variables has to be changed in order for animation to change back to standing/walking.

--------------------------
This is the basic explanation which changes the player animation from walking to floating.
There has to be more variables to set up if you need to also MOVE the player in the water by swimming. For example:
Define a swim-variable in the same scene-name-node as well, with a value of zero. Set up a "checking system" by a "every few seconds do something-behaviour. So if water=0 AND variable for keypress (for swimming (lets say "up-arrow") is 1, then change swim-variable to 1 AND change animation to swim.

BUT, there is another thing - read on:

Although my first attempts in doing this failed and I could not understand why - it did look rock-solid and still it did not change animations.
Quite recently I actually understood why:

My solution was to NOT use the "Game behaviour/person controlled by keybord" for my player, as it probably interfered with the change of animations when doing this. Especially when you want to MOVE your player in the water = swimming. (the general movement-behaviour seems to sometimes overide other animations, even if you choose another key press for swimming/climbing than the already used keys (up, down, left, right and space).
So, if NOT using the "player controlled by keyboard", another script for movement has to be used. Which I found in the forum. If you go for my prescription - search for it! Otherwise I can copy/paste it here again later on.
If you use that movement-script instead, then you have to check the variable for "key-press-up" in the script with a "every-few-seconds-behavaiour). In short, this could look like:
if variable "movement_forward"=1, and variable "water=1", and var "earth=0", then var "swim=1" and animation for player=swimanimation.x.
etc...

Try tweaking around with this for a while to see if you figure it out.
Eventually I might do a video-tutorial on this one, as it involves quite many variables that needs to be checked if they are on/off, etc, in order to execute correct funtions.


behroz-khan
Registered User
Quote
2017-09-22 15:55:11

Yes, but I need that when we hit or come near to water remove gravity for camera.

In simple words:

How to remove gravity manually for a specific scenenode



tim12345
Guest
Quote
2017-09-22 19:07:25

like behroz-khan I too would like the ability to toggle gravity on and off during run time. is it possible?? nobody knows...


niko
Moderator
Quote
2017-09-29 05:55:50

Currently not possible, no sorry :/


Zoo
Guest
Quote
2017-09-29 18:24:18

It is actualy quite straight forward with javascript.. Simply get the position of scene node and move it in the direction of up on loop...you will have to play around a bit with how many voxels u move the y axes.... but give it a bash


just_in_case
Moderator
Quote
2017-09-30 06:47:49

You can turn off the Gravity during runtime.... but turning of gravity means... turning it off for the whole scene...
it will affect the whole scene...

Currently there is no such feature/option available to toggle gravity on or off for a specific scenenode as @Niko Already stated in the post above...

But if you want to turn it off for the whole scene then yes it is possible and is easy as checking a checkbox...


tim12345
Guest
Quote
2017-09-30 14:13:52

it is possible??? but i didn't read anything about this in the manual...


pmax
Registered User
Quote
2017-09-30 15:39:27

Here is the code to deactivate gravity.
var root = ccbGetRootSceneNode();
ccbSetSceneNodeProperty(root,"Gravity",0);



just_in_case
Moderator
Quote
2017-09-30 19:46:20

As i already told you... It is easy as checking a checkbox...
@pmax wrote exactly the same thing.....

But the thing is that it will turn of gravity for the whole scene...

A buoyancy feature is still required to make things float on water....


tim12345
Guest
Quote
2017-09-30 22:40:35

WHAT?!?!!
🔎︎

YEAAHHH!!!!

Thanks guys!


eminem100
Registered User
Quote
2017-10-01 14:16:28

Anyone up to making an action or behavior for MTM? I would be interested in buying that...depending on what it end up doing... you can be quite creative with this


just_in_case
Moderator
Quote
2017-10-01 14:34:21

There are very few peoples who wants to sell the rights, because if they wanted to sell the behaviour/action they created , then there will be more earning if they sell them by their own... Paying 15% commision sounds okay than selling the rights......


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

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


   






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