public bool Play(RenderControl render, float time) { if (mCurrentIdx >= mPoints.Count) { mLineNode.SetVisible(false); return(false); } mTime += time; if (mTime < 100) //距离上次更新不到100ms,就返回 { return(true); } mTime = 0; Vector3 target = mPoints[mCurrentIdx]; mLineNode.SetTransform(MakeTransform(mStart, target)); mLineNode.RequstUpdate(); mMotionTrail.SetPosition((uint)mCurrentIdx, target); mMotionTrail.RequstUpdate(); render.RequestDraw(EnumUpdateFlags.Scene); ++mCurrentIdx; return(true); }
public override void Animation(RenderControl render, float time) { if (mLength > 50) { return; } mTheta += 0.02f; var rotation = Matrix4.makeRotationAxis(new Vector3(1, 0, 0), mTheta); mLength += 0.1f; var trf = Matrix4.makeTranslation(-mLength, 0, 0) * rotation; mWorkpiece.SetTransform(trf); mWorkpiece.RequstUpdate(); Vector3 tailPostion = new Vector3(0, 0, 5); tailPostion.applyMatrix4(trf); mMotionTrail.SetPosition(mCount++, tailPostion); mMotionTrail.RequstUpdate(); render.RequestDraw(EnumUpdateFlags.Scene); }
public override void Animation(RenderControl render, float time) { if (mAnimation.Play(time)) { var trf = mWorkpiece.GetTransform(); Vector3 tailPostion = new Vector3(0, 0, 5); tailPostion.applyMatrix4(trf); mMotionTrail.SetPosition(mCount++, tailPostion); mMotionTrail.RequstUpdate(); render.RequestDraw(EnumUpdateFlags.Scene); } }