# Heightmap ceiling

## Heightmap ceiling

Title says it, triing to rotate (180 deg) a simple hkpSampledHeightFieldShape for a huge cave. X and Z coordinates work as expected - the heightmap is mirrored for X and Z axis. But the heightmap 'bumps' still pointing to +y not downward (-y). My heightmap code works for normal orientation, but not for upside down.
Some code for the rigidbody:

```hkpRigidBodyCinfo rci;
rci.m_motionType = hkpMotion::MOTION_FIXED;
rci.m_rotation.setFromEulerAngles(PI,0.f,0.f);
rci.m_position.set(Position.x+size.x,Position.y,Position.z+size.z);
// rci.m_position.set(Position.x-size.x,Position.y,Position.z-size.z); // for not rotated - works as expected
rci.m_shape = pHimap->pHimapShape;
// creating RB
pHimapBody = new hkpRigidBody( rci );
```

For the shape:

```hkpSampledHeightFieldBaseCinfo ci;
ci.m_xRes = SizeX;
ci.m_zRes = SizeZ;
ci.m_scale = hkVector4(GridSize,1.f,GridSize);
pHimapShape = new CphxHeightfieldShape(ci,HimapData.Array); // CphxHeightfieldShape is from hkpSampledHeightFieldShape ```
3 Beiträge / 0 neu
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Hi hdevfp:
If you want to mirror the Y Axis, do you think you should rotate the Yaw or Pitch as well ? Be careful about the order for rotate, and the define for Euler Angles, for function setFromEulerAngles() , the order will be Roll(Y Axis), Pitch(X Axis) and Yaw(Z Axis)

You can refer to the link:http://en.wikipedia.org/wiki/Euler_angles

And also try to rotate the heightfield shape in Demos such asDemos / Physics / Api / Collide / Shape / TriSampledHeightFieldto test it out

By the way, you can try to use setAxisAngle instead of setFromEulerAngles . I believe it is more clear.

Cheers

Joe
Developer Support Engineer
Havok
www.havok.com

Hi,thaks for the help, i was totally off with the mirroring, it seems i rotated around my y angle (yaw). I works now with setAxisAngle perfectly.Cheers

## Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied?