Heightmap ceiling

Heightmap ceiling

Portrait de hdevfp

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 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de havok_joe
Best Reply

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 as Demos / Physics / Api / Collide / Shape / TriSampledHeightField to 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
Portrait de hdevfp

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

Connectez-vous pour laisser un commentaire.