Hi
I 'm looking for how to move camera in specific location in the game how can it be ?
thanks
Hi
I 'm looking for how to move camera in specific location in the game how can it be ?
thanks
You should use Python. The script would be something like:
from bge import logic
cont = logic.getCurrentController()
obj = cont.owner
obj.position = [1.0, 2.0, 3.0] # Position of the camera
Run that script on a Python controller connected to a sensor, and the camera will move to the position [1, 2, 3].
thank you but I’m beginner I do not know what
[1.0, 2.0, 3.0] # Position of the camera
and I do not know where I put the position of object and where I found the position?
thanks again
Ok, to set an object’s position, you have to use a position matrix - the x,y and z coordinates.
In the above example, solarlune has set x as 1.0, y as 2.0 and z as 3.0.
If you know the x,y,z coords of the position, set them in instead of the numbers solarlune used as an example:
from bge import logic
controller = logic.getCurrentController()
owner = controller.owner
owner.position = [x,y,z]
replace x,y,z with the corresponding x,y,z values.
If you want to set it to the position of an object in the scene, you’d have to use this;
from bge import logic
controller = logic.getCurrentController()
owner = controller.owner
scene = logic.getCurrentScene()
object = scene.objects["object_name"]
owner.position = object.position
change the word object_name with the name of the object