How to rotate a node inside of KinematicBody?

AWHDRi

01-09-2009 19:35:33

Here is my code
OGRE3DKinematicBody* mP1KB = mRenderSystem->createKinematicBody(new NxOgre::Capsule(50, 160), NxOgre::Real3(-300, -70, 0), "ninja.mesh");
mP1KB->getSceneNode()->yaw(Degree(90));//Not works
How else i can rotate ninja.mesh which is a part of Kinematic Body? And why it not works in the way that i showed before ?

betajaen

01-09-2009 19:40:23

NxOgre will put the orientation right back as it was after you change it, it's how it works.

I assume you want the actual mesh to permanently face in a particular direction, you can use the ImageMagick tool to convert the mesh for you.

KyleKatarn

02-09-2009 11:41:52

Sorry to hijack the thread, but if that's the case, how would you be able to have a player character which cant rotate? Sorry, physics is very new to me.

betajaen

02-09-2009 14:00:05

If it's a kinematic actor that uses a capsule, you don't. What usually happens is that you store a yaw value (which is modified increased by the mouse moving right, and decreased by the mouse moving left) somewhere in your code then using that yaw value you create a movement vector to move in a particular direction (north, south, east, west) - it goes more or less this; my_direction * Ogre::Quaternion(Ogre::UNIT_Y, my_yaw)); Your KinematicBody then doesn't really have a direction as such - you could think of it is not looking at anything. Then to make your graphics sync up with the physics and your yaw value. You only apply the translational component when moving your scene node player, and at the same time rotating it to match up the yaw value.

If it's not a kinematic actor, then you can add some torque or add some angular acceleration to rotate it.

KyleKatarn

02-09-2009 14:40:40

I think I get it, the capsule/kinematic actor doesn't rotate, but the mesh can/does? The capsule just stays static (in relation to the mesh it's attached to)?

betajaen

02-09-2009 14:50:38

Pretty much.

If it's a box though, then it has to rotate; but then you have problems with the edges clipping something on the floor - so literally turning you could flick something across the room - which is why capsules are used. There also easier on the solver than a cube.

KyleKatarn

02-09-2009 14:55:40

Ah I see, thanks for the help. =]

Also 1 more quick question, the capsule would only need to be as large as my mesh, right? Whereas if I wanted to implement something like Ragdolling (in the seemingly distant future), I would need something like a capsule for the torso, sphere for the head, 2 cylinders per arm and leg, etc?

Disregard that, it seems that actually reading stuff DOES get you somewhere, lol.

betajaen

02-09-2009 15:08:44

It's okay.

Ragdolls are usually created when they are needed - which probably what you read. You see with physics the simpler it is, the faster it is. The more accurate it is, the slower it is.