GeorgeP Posted May 16, 2012 Posted May 16, 2012 Hello.I face a problem concerning the world direction of an object.I create a box using the create_box function in primiives.hI set the world direction to 0,0,-1.After 1-2 updates, the world direction becomes 0,0,-1 even though i dsont change it.Here is the code of the object. class DummyObject { Object object; DummyObject(Vec3 position) { object = create_box(vec3(1.0f),0,translate(position)); object.setWorldDirection(vec3_zero); log.message("initial direction: " + object.getWorldDirection() + "\n"); } ~DummyObject() {} void update() { vec3 position = object.getWorldPosition(); log.message("World direction: " + object.getWorldDirection() + "\n"); position += object.getWorldDirection(); object.setWorldTransform(translate(position)); } }; and here is the output:Why does the direction change without calling any setWorldDirection to the specific object?Thank you.
Guest anet Posted May 17, 2012 Posted May 17, 2012 Direction vector can't be a vec3_zero. It is always a vector with unit length. Thus, when you try to set vec3_zero as an object direction, engine calculates new transformation for it. And apparently it becomes default direction vector: (0,0,-1)
Recommended Posts