Skip to content

After tutorial 47, the camera has inheritance issues #40

Description

@DefenderofTheTimelines

When the camera is added as a child of testMesh1, the rotation and position are inherited properly.
When the camera is added as a child of testMesh2, the position is inherited, but rotation is not.
What I mean by this is if I rotate testMesh2 to "face" testMesh1, the camera will not start facing testMesh1, but the movement axes are correct. Code:


testMesh1.getTransform().getPosition().set(0, 2, 0);
testMesh1.getTransform().setRotation(new Quaternion(new Vector3f(0, 1, 0), 3.14159f/2));

testMesh2.getTransform().getPosition().set(0, 0, 10);
testMesh2.getTransform().setRotation(new Quaternion(new Vector3f(0, 1, 0), 3.14159f));

testMesh1.addChild(testMesh2);
testMesh2.addChild(camera);
getRootObject().addChild(testMesh1);


In my program, with the above code, the camera will start at position of testMesh2, but the camera is facing 90 degrees to the left, off the plane, instead of pointing at testMesh1. Even weirder, is the fact that moving forward moves camera toward testMesh1, and the other move axes all correspond to this.

In other words, the camera's move axes are correct, but it is not facing the correct direction, reguardless of the angle given to the second test mesh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions