Page MenuHome

Objects disappear when aligned to certain angles
Closed, ResolvedPublic

Description

In the example below I'm using KX_GameObject.alignAxisToVect to align a cube to face normals. The cube disappears at certain angles.
Tested with a build from today. 2.76b does not exhibit the error.

Event Timeline

Lee Pugh (pqftgs) raised the priority of this task from to 90.
Lee Pugh (pqftgs) updated the task description. (Show Details)
Lee Pugh (pqftgs) added a project: Game Engine.
Lee Pugh (pqftgs) edited a custom field.
mangostaniko claimed this task.EditedFeb 18 2016, 4:22 AM
mangostaniko added a subscriber: mangostaniko.

The most evident symptom is a division by zero (epsilon margin MT_fuzzyZero comparison) in the normalization of the base vectors of the new aligned coordinate system, in KX_GameObject::AlignAxisToVect.

Thus something might have gone wrong in the coordinate system setup.

In the construction of the new coordinate system with one axis aligned to the vector, the use of a parallel unit vector should be prevented, however this was not the case due to a floating point precision issue (subtraction of values with too far apart exponents).

This lead to symptomatic division by zero errors when normalizing the new base vectors, due to which the aligned object was not displayed.

The patch D1811 fixes the issue for me, waiting for review.

mangostaniko changed the task status from Unknown Status to Resolved.Feb 26 2016, 12:34 AM