# rotation and position of rigidbody [SOLVED]

## rotation and position of rigidbody [SOLVED]

Solve:The problem was ofcourse havok column based system.the solution for this was not to rotate the terrain but to flip it.for ( UINT z = 0; z < verticesAlongLength; z++ )

```{
for ( UINT x = 0; x < verticesAlongWidth; x++ )
{
float height = (
pVertices[z * verticesAlongLength + x].X * transform->_12  +
pVertices[z * verticesAlongLength + x].Y * transform->_22  +
pVertices[z * verticesAlongLength + x].Z * transform->_32  +
1 * transform->_42
);

//m_data[x * verticesAlongLength + z] = (hkUint16)pVertices[z * verticesAlongLength + x].Y; // Old not working code

m_data[x * verticesAlongLength + z] = (hkUint16)pVertices[z * verticesAlongLength + x].Y; // Code i changed
}
}```

Original:Hello fellow havoc spreaders!I have a problem with the folowing code:

```hkpRigidBodyCinfo rci;

hkRotation rotationHavok;
rotationHavok.setAxisAngle( hkVector4(1.0, 0.0, 0.0), -90 * ( D3DX_PI / 180 ) );

hkVector4 tPosition;
tPosition.setMul4( -0.5f, heightFieldShape->m_extents ); // center the heightfield

hkTransform tTransform;
tTransform.setIdentity();
tTransform.setRotation( rotationHavok );
tTransform.setTranslation( tPosition );

heightfield	 rci.setTransform( tTransform );```

I wanted this code to rotate the rigidBody(HeightField) but it gives some weird results which i really can't explain because i see no reason for them to appearplease am i doing something completely wrong if so? could you point it out?thanks in advance-snarf

1 post / novo 0
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.