void SFX3DObject::getEarTransform( MatrixF& transform ) const { // If it's not a ShapeBase, just use the object transform. ShapeBase* shape = dynamic_cast< ShapeBase* >( mObject ); if ( !shape ) { transform = mObject->getTransform(); return; } // It it's ShapeBase, use the earNode transform if one was defined. // Otherwise, use the camera transform. TSShapeInstance* shapeInstance = shape->getShapeInstance(); if ( !shapeInstance ) { // Just in case. transform = mObject->getTransform(); return; } ShapeBaseData* datablock = dynamic_cast< ShapeBaseData* >( shape->getDataBlock() ); AssertFatal( datablock, "SFX3DObject::getEarTransform() - shape without ShapeBaseData datablock!" ); // Get the transform for the ear node. const S32 earNode = datablock->earNode; if ( earNode != -1 && earNode != datablock->eyeNode ) { transform = shape->getTransform(); transform *= shapeInstance->mNodeTransforms[ earNode ]; } else { GameConnection* connection = dynamic_cast<GameConnection *>(NetConnection::getConnectionToServer()); if ( !connection || !connection->getControlCameraTransform( 0.0f, &transform ) ) transform = mObject->getTransform(); } }
Move HoverPodController::getMove(ShapeBase* obj) { Move retMove = NullMove; GameConnection* client = NULL; if(!Sim::findObject(mClientId, client)) return retMove; ShapeBase* control = client->getControlObject(); if(control) { Move cMove = client->lastReceivedMove(); Point3F v1, v2; control->getTransform().getColumn(0, &v1); control->getTransform().getColumn(1, &v2); Point3F pv = v1*cMove.x + v2*cMove.y; //pv = mDirection * mDot(pv, mDirection); obj->getTransform().getColumn(0, &v1); obj->getTransform().getColumn(1, &v2); retMove.x = mDot(v1, pv); retMove.y = mDot(v2, pv); } return retMove; #if 0 if(this->isServerObject() && this->isMounted()) { Move mMove = NullMove; ShapeBase* mount = this->getObjectMount(); if(mount->getType() & VehicleObjectType) { Vehicle* vehicle = (Vehicle*)mount; if(move && move->x != 0) { mMove.yaw = move->x; } else { Point3F zv; vehicle->getTransform().getColumn(2, &zv); zv.normalize(); Point3F m = vehicle->getRigid().angMomentum; //Point3F v = vehicle->getRigid().angVelocity; F32 dot = mDot(zv, m); //Con::printf("%f / %f %f %f / %f %f %f", dot, // m.x, m.y, m.z, v.x, v.y, v.z); mMove.yaw = dot / 50; } if(move) mMove.y = move->y; } else if(move) { Point3F v1, v2; this->getTransform().getColumn(0, &v1); this->getTransform().getColumn(1, &v2); Point3F pv = v1*move->x + v2*move->y; mount->getTransform().getColumn(0, &v1); mount->getTransform().getColumn(1, &v2); mMove.x = mDot(v1, pv); mMove.y = mDot(v2, pv); } mount->processTick(&mMove); } #endif