Random assets placer (v3)

It only works for three or four of the added planes named ground.Here is the zip with the blend.:confused:

Attachments

my game.zip (5.56 MB)

Really? that would be funny, because the script ive adapted for you does not look for plane with name Ground.

I will take a look in a while, but itā€™s really time for you to get an understanding of how you need to adapt stuff.
because to be honest this should not be my problem. (i got your old setup ready, didnā€™t share it with you because i wanted you to do it on your own).

#edit
the empty in layer 1, remove the always-python.
the ground plane remove true pulse put it on single pulse

Added a small description to get it to work with a sphere as the ground object.

the trees,rocks and flowers does not parent to the rotating sphere.do i have the code piece in the right place in the python code?

Attachments

rtscontrols.blend (3.06 MB)

not exactly , ground i meant as the ground object, and you placed it on the wrong line
place this line on line 126 and remove the other one.


new_obj.setParent(terrain_object)

changed the description in the first post.

It stopped working when i put that in.

Attachments

rtscontrols.blend (3.06 MB)

Even if the Sphere is named Sphere
it does not work.Did you test it?

yes i did test it so your doing something wrong
only thing you have to do is put the code on line 126 and it will work

#edit
you messed up like i thought, as stated above only thing you need to do is put the code on line 126, you changed the objects name so yes it wont work, look at the console fix those errors first, you see it works.

Could you make it so the trees stick straight out from the curved
surface of the sphere?Instead of straight up.

adjust the script, and tell it that the tree should align with the ground. everything is explained in the script like this:


objects = {# name of obj - distance check - align to floor - spawn max amount
                    'tree_trunk'    : [8.5, True, 10],
                    'tree'          : [1.0, False, 55],
                    'stone_big'     : [1.4, True, 25],
                    'stone_small'   : [0.7, True, 25],
                    'flower_red'    : [0.5, False, 250],
                    'flower_blue'   : [0.5, False, 250],
                    'grass'         : [0.4, False, 350],  
                    'target_dummy'  : [0.5, False, 10],    
                    'ammo_pistol'   : [0.2, True, 10], 
                    'ammo_lmg'      : [0.2, True, 4], 
                    'barrel'        : [0.8, False, 5],       
                    'bush'          : [0.6, False, 110]
                    }

so set tree from False to True and it will align.

It works now.

A really nice resource! Will probably use this in the future. I hope you donā€™t mind if I use the distance check in another file!:smiley:
Anyways, I tried to do something like this before, managed to do something quite good, but nothing as refined as this. Also I might optimize my scripts using some of your codeā€¦

Anyhow, good job!

I hope you donā€™t mind if I use the distance check in another file!

Not at all, go ahead. itā€™s just combining vectors to get a direction for the ray to cast to.

Glad to hear you like it! :smiley:

I have not checked this but, do the objects despawn also(own.endObject())? I imagine it would be easier to add this to a distance sensor and editObject actuator on the individual objectsā€¦but still curiousā€¦I never actually got around to looking at this file(just busy with valiant :))

you got time to ask questions etc. but you donā€™t have a minute to look? :stuck_out_tongue:

  • No objects donā€™t de-spawn, itā€™s an assets placer not an LOD system.
  • The script handles everything why would you make a mess out of your blend with logic bricks, thatā€™s not easier.

With that said, itā€™s pretty easy to add an LOD to it, but thatā€™s not up to me but for the one who needs an LOD with it :smiley:

to add this to a distance sensor and editObject actuator on the individual objects

This is not a good way at all, what if you have 1000+ objects, they all doing distance checks every frame?
better to control this trough python.

simply do something like:

distance = player.getDistanceTo(object)
if distance > 10.0:
    $do stuff

when I make planet too big the trees , rocks and grass are not placed.really nothing is placed.

Did you change the Planets dimensions and the tallest object in the script this time? It should work no matter how big the planet is, that is if you did set the right settings in the script. Just like past year, the right dimensions makes or brakes it.

that worked here is a screenshot.i used makehuman
to make that character.now i have another problem.
my character continously plays itā€™s animation.
i do not know why that is happening.

Thought so :smiley:

You should make a new topic for this question, Because 1) itā€™s not releated to my assets placer. 2) i/we have no clue on how you have it setup

i bet you have the animation on loop-end mode, put it on loop/stop mode, so when you press and hold the key it loops the animation, then when you release the key it will stop playing the animation.

Nonetheless iā€™m not sure what you got and causing it, but it should not be answered in this topic.

okay I was just talking about my problem even though it was off topic.