Limit movement copy on specific axes

4

I'm developing a game in Blender and programming in Python. I had to develop solutions to work with oculus rift. Where my character follows the movement of the user's vision.

I'm using the following function to copy camera movement to the character:

import bge

def main():
    scene = bge.logic.getCurrentScene()

    mov1 = scene.objects["Camera"]
    mov2 = scene.objects["Cube"]

    mov2.worldOrientation = mov1.worldOrientation

How do I limit the copy movement of the mov2 only on the X and Y axes by eliminating movement of the Z axis? For my character floats on the scene when I look up.

FPS running link

FPS with oculus rift link

    
asked by anonymous 28.07.2015 / 01:13

2 answers

0

Update : If the property is a sequence of three elements, just replicate the first two and force the third to zero:

mov2.worldOrientation = [mov1.worldOrientation[0], mov1.worldOrientation[1], 0]

Original :

It's been a long time since I started Blender - but you've tried instead of:

mov2.worldOrientation = mov1.worldOrientation

Make:

mov2.worldOrientation.x = mov1.worldOrientation.x
mov2.worldOrientation.y = mov1.worldOrientation.y

?

    
28.07.2015 / 15:18
0

Yes, I tried. It seems to me that the correct syntax for the function would be:

mov2.worldOrientation = [1.0, 1.0, 0.0]

where:

mov2.worldOrientation = [x, y, z]
    
28.07.2015 / 15:47