Move with a object

I looking through some old files I’ve downloaded and I found one called landscapetest.blend, so i opened it up.You control a jeep and ride around a landscape but one thing I noticed was that the skybox was parented to the jeep but didnt rotate with it.It just simply moved with it.

Anyone know how to do this?

you have to use python.

instedd of setting positions and orientation you just set the position.

first you need to find the position of the player and just set that position on the skybox.

here is a little script showing how can look.

import GameLogic

just rename the players name to Player and the skybox`s name to Skybox. it should work, havent tested

edit: and ofcorse make an object runn the script .(always sensor etatched to a controller. the controller should be set to Python. and in script: write the name of this script.)

How do you find the position of an object?Also, does the skybox have to be parented to the player?

Also when I looked at the landscapetest file, the skybox doesnt have any logic at all.Thats what confused me :expressionless:

That is because the player is running the script, or a similar script.

to find an objects owner. you can use
This function gets a list of all objects in the current scene. And to get a serten object inside this list you have to write this oblist[“OB”+“Object_name”]
cool he? :slight_smile: . so you dont need to have a logic bricks connected to this script wwhen you run it in the game.

when you get an object inside the list you can use all the same functions on it as when you use the own. (example getPosition() or setPosition())
to see all functions inside an owner (or anny other moduele for example)
use this
print dir(own)

Hope it helped u :slight_smile:


Or possibly vertex parented?

Select the skybox then the jeep, press tab and select a vert to be the parent. :slight_smile:


NOR.J, I tryed what you suggested but it didn’t seem to work, since I’m new python :expressionless: I don’t know what I’m doing wrong.Can you post a example of one?So I can compare of what you did differently.

Thanks in advanced

I also realised the set position could be really useful for inventory scripts :slight_smile:

What’s vertex parenting, never heard of that, is it a new feature and where is the button for it? :expressionless:

No, it’s a very. very old feature. :wink:

Select both objects as you would for a regular parenting, then press TAB, select a vert, and press Ctrl+P. The object will follow the vertex without rotating with it. :slight_smile: You can also parent to faces by selecting a aface instead of a vertex before parenting. That way, the object will follow the deformation of that face.

Ok, thanks it works perfectly now :slight_smile: