About Store Forum Documentation Contact



Post Reply 
Update Terrain
Author Message
ronghester Offline
Member

Post: #1
Update Terrain
Hi There,

I have a grass (object painted) on the terrain and in run time I want to remove the grass from particular area (let say remove grass from radius of 10unit from player position). Is it possible to remove the grass from terrain in run time ?

Thanks
09-25-2018 06:14 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Update Terrain
yes, please check Game.Area.Data.foliage_objs
09-25-2018 11:04 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #3
RE: Update Terrain
(09-25-2018 11:04 AM)Esenthel Wrote:  yes, please check Game.Area.Data.foliage_objs

It looks like that is the way to go. Thanks a lot!
09-26-2018 06:26 PM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #4
RE: Update Terrain
Sorry, need some more info on how to use the foliage objs. First of all it is not listed on Data member and when i am using this <Game.Area.Data.foliage_objs>

Getting error "invalid use of non static data member"
02-27-2020 07:20 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Update Terrain
first you need to access the area:
world manager:
Area* areaActive ( Int i )C; // get i-th active area , if the index is out of range then null is returned
Area* areaActive (C VecI2 &xz)C; // get active area at 'xz' area coordinates, if the area doesn't exist or isn't active at that coordinates then null is returned (which means that only area with AREA_ACTIVE state can be returned)
Area* areaLoaded (C VecI2 &xz)C; // get loaded area at 'xz' area coordinates, if the area doesn't exist or isn't loaded at that coordinates then null is returned (which means that only area with AREA_CACHE AREA_INACTIVE AREA_ACTIVE state can be returned)
02-27-2020 08:07 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #6
RE: Update Terrain
Thanks that works!

Is there any way to know the current activeArea ? It is impossible to find it based on the player position.
02-27-2020 01:37 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #7
RE: Update Terrain
Ye normally you do your world pos xz to area conversion, that is based on the size of the area smile

Worldpos xz / areasize. if i am not mistaking
(This post was last modified: 02-27-2020 04:29 PM by RedcrowProd.)
02-27-2020 04:27 PM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #8
RE: Update Terrain
Woldpos xz/ areasize did not help but i will try again.

Meanwhile i have another question :
If i have to draw grass programmatically (i want the plants to be aligned on x and z axis separated by equal distance just like Farm) then whats the way to achieve that ?

Small snippet will help.

Thanks
03-15-2020 01:16 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #9
RE: Update Terrain
I don't think it is possible with built-in grass functionality but for other types of objects (like Static) you can just use loop and align objects by their bounding box or actor shape's width and depth.

If the objects is dynamic you can search for near objects sharing the same type and set new position relatively to them. There is a method [/code]for that in Game.World class.
03-15-2020 08:00 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply