# PVR Model POD scaling animation problem

**URL:** https://forums.imgtec.com/t/pvr-model-pod-scaling-animation-problem/2039
**Category:** PowerVR Insider
**Created:** [April 9, 2014, 11:37am UTC](https://forums.imgtec.com/t/pvr-model-pod-scaling-animation-problem/2039 "2014-04-09T11:37:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mkandula](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/mkandula/32/123_2.png) [@mkandula](https://forums.imgtec.com/u/mkandula)
#### Post date: [April 9, 2014, 11:37am UTC](https://forums.imgtec.com/t/pvr-model-pod-scaling-animation-problem/2039/1 "2014-04-09T11:37:48Z")

</div>

Hi  
  
  
  
I was experiencing a crash when one of the .pod file was having scaling animation.  
  
  
  
The crash was happening here (in PVRTModelPOD.cpp in GetScalingMatrix() )  
  
`
if(node.nAnimFlags & ePODHasScaleAni)
{
if(node.pnAnimScaleIdx)
{
PVRTMatrixVec3Lerp(
v,
(PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+0]],
(PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+1]], m_pImpl->fBlend);

}

`  
  
  
  
  
  
I fixed the crash using the following fix  
  
  
  
`
if(node.pnAnimScaleIdx)
{
if(m_pImpl->nFrame + 1 >= this->nNumFrame) {
v = (PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+0]];
}
else {
PVRTMatrixVec3Lerp(
v,
(PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+0]],
(PVRTVECTOR3&)node.pfAnimScale[node.pnAnimScaleIdx[m_pImpl->nFrame+1]], m_pImpl->fBlend);
}
}
`  
  
  
  
Please suggest a proper fix. The condition m\_pImpl-\>nFrame + 1 \>= this-\>nNumFrame, was needed to be dealt with 🙂

---

<div class="post-metadata">

### Author: ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)
#### Post date: [April 10, 2014, 1:21pm UTC](https://forums.imgtec.com/t/pvr-model-pod-scaling-animation-problem/2039/2 "2014-04-10T13:21:44Z")

</div>

Hi Madan,  
  
  
  
As mentioned in the SetFrame() comment, the tools expect the user to check that the input frame value value is valid for animation. For looping animation, frame 0 and the last frame should be identical, so there is no need to wrap between the last and the first frame animations.  
  
  
  
We chose not to add an array bounds test to the function, as its an additional operaiton that would only be required for looping animations.  
  
  
  
Regards,  
  
Joe

---

<div class="post-metadata">

### Author: ![mkandula](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/mkandula/32/123_2.png) [@mkandula](https://forums.imgtec.com/u/mkandula)
#### Post date: [April 10, 2014, 1:53pm UTC](https://forums.imgtec.com/t/pvr-model-pod-scaling-animation-problem/2039/3 "2014-04-10T13:53:57Z")

</div>

Hi Joe,  
  
  
  
Thanks for the insight into the problem ! Really helps.
