Ambiera ForumDiscussions, Help and Support. |
|
| [ 1 2 ] Page 1 of 2 |
|
|||||
|
Ok, we're in the home stretch, people! Well, at least as far as Stage 1. Now comes the next step... lifting the fog. I don't imagine it would be that easy to gradually lift (fade away) the fog, as you're climbing the mountain, so I'd assume making it just vanish, once you get to the top of one of the mountains would be the chosen tactic. I'm assuming all the mountains are the same height, so knowing the actual altitude at the plateau would be useful in knowing when to trigger the fog removal. Question is... how would this be done? |
||||
|
well, it is easy to gradually lift the fog as you climb the mountain, I don't think you should use sudden removal of the fog as it won't look that good viusally. You can easily acess the root scenenode property for "FogDensity" and based on the altitude of the player on the mountains you can decrease the "FogDensity" just use this command. var root = ccbGetRootSceneNode(); you can execute the above command in execute javascript action, whenever you need to edit the fog density, just change the "your value here" with actual fog value for the fog density. Hope that helps |
||||
|
wrote: well, it is easy to gradually lift the fog as you climb the mountain, I don't think you should use sudden removal of the fog as it won't look that good viusally. You can easily acess the root scenenode property for "FogDensity" and based on the altitude of the mountains you can decrease the "FogDensity" just use this command. var root = ccbGetRootSceneNode(); you can execute the above command in execute javascript action, whenever you need to edit the fog density, just change the "your value here" with actual fog value for the fog density. Hope that helps Ok, this triggered a thought in my head... but the problem is, I sense that part of the height limiting behavior would somehow play into this code as well... because I need to know how high I'm going up the mountain to trigger the next decrease in fog density. The default is 10 (which actually is a little too short in actual game usage, but...), but I'm having trouble deciphering what code does what... and how much of it I actually need. And can I even use any of that code in immediate javascript execution mode (I made an earlier attempt and it didn't seem to work), vs behavior file mode (which works perfectly). |
||||
|
Use on proximity events to set markers for fog density changes to occur without coding - or search the forum for "get distance between two points" to code it, based on the character's perpendicular distance from a ground plane. |
||||
|
VP wrote: Use on proximity events to set markers for fog density changes to occur without coding - or search the forum for "get distance between two points" to code it, based on the character's perpendicular distance from a ground plane. How? Where? The mountains are just bumps in the terrain node. They're not physically different nodes. So, how would I do a proximity event for my character or the terrain itself? And, as for doing a forum search for "get distance between two points", it only lead me to this thread! Seriously! |
||||
|
If there is no node ,you can always make one..and attach proximity on it. For example CUBE ( set collision off for it and put it inside the mountain ) Set proximity to a BOX mode. If i have time i will look for this script -i have this script already made. |
||||
|
wrote: If there is no node ,you can always make one..and attach proximity on it. For example CUBE ( set collision off for it and put it inside the mountain ) Set proximity to a BOX mode. If i have time i will look for this script -i have this script already made. But, if I want to be able to climb ANY mountain... there's like 6 or 9 of them. If I stacked, say, 3 cubes (one cube per step of fog dissipation) inside each mountain, that would be a total of 18-27 cubes I have to place! And I have to have them all numerically indentified... ugh! |
||||
|
you need actually just one mountain Highest one to setup.. on proximity area can cover all the other mountains also. i have script for this i send it tomorrow- but its good to practice with other methods as on proximity. EDIT: script: https://drive.google.com/file/d/... MaxHeight value if you put there higest point of the map then if player reaches it -fog will be 0 so to keep some fog in scene add some value to it. On my map Higest point was 50 but in script i put 60 so there will be never zero fog. |
||||
|
Maybe I didn't get the point, but why don't you simply use the player altitude as fog density parameter? I mean, negatively, and not necessarily linear. You could have a density value for every foot above sea. This may be a curve, or even a cloud layer. (Wow, did anybody every make a game in which you see the clouds from above, like a dry ice ocean?) And re Distance, there may or may not be integrated functions that return a distance, however, you are always on the save side when you know how to implement it using the basics: Distance between two points by 3D pytagoras: distance= squareroot of ((xd*xd)+(yd*yd)+(zd*zd)) (xd is x distance...) or in javascript and coppercube:
|
||||
|
@Sven - It works perfectly! However... there's one teensy, tiny problem... the fog comes back as I climb down the mountain! Once you've climbed the mountain and the fog goes away, I want it to stay gone! |
||||
|
Sounds like it's already sorted with coding.... but, as for my comment, you don't need separate nodes for the mountains - you just needed a single on-proximity event, attached to a ground-plane. IE: Make a plane, set position of plane to ground-level, stretch size across the entire ground, then just set on-proximity (cube, not sphere) to the height you want the fog to start lifting, use action: "on-leave" proximity, set fog density (value). If you want several stages of fog-thinning (so it gets thinner, the higher he climbs), just use several on proximity-events attached to the same ground-plane - you can also use "on enter" proximity - to make the fog thicker again when he moves down the mountain. |
||||
|
Ok, the code Sven provided works perfectly. But I want to the fog to stay GONE, after you've reached the top of the mountain, so when you climb back down, the fog does NOT reappear. |
||||
|
Use the coding solution provided - it's probably a better solution. ...but just to explain how I use a single"on proximity" node to detect player-height (even with multiple terrain-mountains), I made a simple ccb file for you with no-coding... https://veganpete.itch.io/reques... Download the one called "fog-fade". *You can use the same trick for playing a sound when the player jumps/falls/lands, when a car mounts a pavement/curb, to fade a spaceship sound out when it gets far away, to play a splash animation/sound when objects land in puddles: etc. |
||||
|
Above example uses a single on-proximity node...climb any mountain to reduce fog-density, the higher you go. Fog density doesn't return when climbing back down. |
||||
|
wrote: Above example uses a single on-proximity node...climb any mountain to reduce fog-density, the higher you go. Fog density doesn't return when climbing back down. In as much as was possible for me to control that cardboard cutout of that rat creature ("Lupain"? Seriously?), I did notice it seemed that the fog, indeed, did not return, coming back down. But surely the same thing could be incorporated into the behavior file that Sven provided, which was much more gradual of a fog fade. I just need fog turned off when you reach the top. But how to make that happen? |
||||
| [ 1 2 ] Page 1 of 2 |
|
|