object position

What i would like a script to do is snap just one added object to the empty when my character get near the empty.The added objects come from the add object actuator.I would like the script to use the radar sensor.Could you post an example script?

Hi 3d solar system builder,

could you rephrase that (maybe with a sketch).

BTW: you can’t sense empties with a radar as they are no physics object and do not have a mesh.

The empty has the radar sensor on it and then the added mesh snaps to the position of the empty.Also when the empty detects the player it sends a signal to the added mesh to come to the position of the empty while instructing the other added meshes of that type to stay behind.It may seem unreasonable to want to make a planet this way but that is what would like to do.It would be good if the program randomly selected
from terrain meshes that i made.The terrain meshes could have enemys on them and not.Latter on i would like to extend it.Something like that would be a great add on for the blender game engine.

Let me rephrase it:
[I guess you mean game objects (=mesh objects) rather than meshes ;)]

you have an empty
you have several mesh objects (they where added beforehand)
you have a player of whatever type of object (I assume at least a detectable collision box)

If the empty detects one (or more?) mesh objects with radar -> the detected mesh objects will be placed at the position of the empty
If the empty detects the player -> it notifies (all?) added mesh objects
If an added mesh object receives the notification -> it will be place (or move?) itself at the empties position

If the empty detects the player -> added mesh objects stay behind (what are “other” and what means “stay behind”?)

Hmm, that still does not make much sense to me.
As suggested a sketch might help to show your vision.

Edit:
I know sometimes it is hard to describe what you have in mind. But as long as it is not possible to catch this into a proper form it is not possible to transfer this thoughts into bge logic.


Add terrain tile to position of empty.

Attachments



empty --> message “add terrain” to empty.001
empty.001 --> adds terrain

  • you want “terrain” (after added) be placed at the location of empty?

Could it be you are trying to create a sort of LOD?

Why you do not add “terrain” from “empty” itself?
If you do that you do not need to move anything -> it is already there = much easier

I think your main problem is that “empty.001” does not know “empty”. It only knows it should add “terrain”

Because i want the empty parented to the terrain tile to snap another terrain tile to it when the player is near.Did you look at all three pictures.

This is what I mean with clear description. It is not really clear to me.

If I understand you right:

Then you add a terrain tile. If it is near another terrain tile-> It should replace itself that it connects to the other one (like a puzzle tile).

Is it that what you want?

I am trying to get around the scaling problem when you add a object from a added object.

Make sure all scales are applied, then they will always add at the right scale.

I will explain it another way.I would like to spawn the ground in the direction of travel of the player in front of him and end the ground behind the player.

This makes much more sense :D.

If I see it right you want to use empties to look for the player.
When the player is near they add the terrain they belong to.
When the player leaves the empty’s range, the terrain will be removed.
This concept has a large downfall: You need a lot of heavy sensors (near, radar). Whatever you save on render time will be eaten by the logic processing.

Finally it is like LOD.

I think torakunsama developed such system for his space ship game.
Ideasman42 did a demo of large worlds as well. Have a look at: http://blenderartists.org/forum/showthread.php?158321 (blender 2.49)

These might not fit your current situation, but I guess you can find some ideas that help you.

That is what would like to do with a python script but have the script use that process to make a planet of course the planet would have to have gravity.The planet is made out of bent ground terrain tiles and when the player is near they add the terrain they belong to.When the player leaves the empty’s range, the terrain will be removed.I would like the script to bend the planes according to what size planet you specify.

Something to consider on such a project:

A) Planets are usually huge -> usually you would not able to tell if you are standing on a flat landscape or a planet
B) Bending meshes is not that easy (but possible)
C) Default gravity is along Z

For your game are you thinking of very small planets (e.g. e few hundreds meters?)
Do you need to see you are on a sphere?

I ask this as it is much easier to create an infinite flat landscape rather than a sphere.

Would it be sufficient enough to build the surface from grid tiles?
Means do all tiles have the same dimensions e.g. 10Y x 10Y?
this way you can place them as 10x10 grid (like a puzzle)
Or do you need values in-between? w.g. one is 10x10 another 1x3?

Gravity:
Easiest: Having a constant gravity (= no change needed)
More difficult: changing the gravity dependent on the location of the player
Hardest: Gravity to a point [by constantly running Python code]

What happens with enemies and items on tiles not near the player? will they disappear with the tile?

I want it to be a addon that lets you make these planets automatically from scratch you just add the terrain meshes you have made with house, buildings,vehicles,anything you want and also emptys that spawn the enemys.I want the planets terrain tiles to start off as pieces of a sphere.People just add the mountains and anything else to it as meshes with game logic or without.I want the add on to make gravity for planet automatically.You just click on a button that says make planet gravity.I would like them to be grid tiles but here’s my problem all tiles cannot have the same dimension if you look at a icosphere each face is a different shape.Gravity to a point i would like.Enemies and items on tiles not near the player will disappear with the tile.

3d solar system builder,

this all sounds pretty specific. I do not think that an add on has a good use to others. But it could be a good idea for a (editable) game. But this is just my opinion.

In general you have to find solutions to several requirements as written earlier. I think you need to work out your design first (as you already do) and when all fit together you can go and implement the solutions you are thinking of.

Let me summarize some of the requirements:

  • how to setup planetary gravity (is it necessary at all?)
  • how to make terrain patches fit together? (like puzzle)
  • how to do do sector switching (terrain + items)? Store/restore etc.
    …

Does that make any sense to you?

Yes that does make sense.