Stuck with 3D headings. I have 3D cone (ofConePrimitive), which moves with following algorithms:
ofPoint pos; ofPoint axisX, axisY, axisZ; float gap = 5.0; in setup(): cone.set(20, 80); pos = ofPoint( 0, 0, 0 ); axisX = ofPoint( 1, 0, 0 ); axisY = ofPoint( 0, 1, 0 ); axisZ = ofPoint( 0, 0, 1 ); in update(): float time = ofGetElapsedTimef(); float twistAngle = 5.0 * ofSignedNoise( time * 0.3 + 332.4 ); float rotateAngle = 1.5; axisX.rotate( twistAngle, axisZ ); axisY.rotate( twistAngle, axisZ ); axisX.rotate( rotateAngle, axisY ); axisZ.rotate( rotateAngle, axisY ); pos += axisZ * gap; cone.setPosition(pos); in draw(): cone.draw();
What I need and I couldn’t figure out how to make cone heading its movement.’
In other words, its tip (highest point) should be always directed forward.