OgrePointSpecification::OgrePointSpecification(Vector3 pos, RotationVector rotation) : PointSpecification() { string name="Node"; name+=Ogre::StringConverter::toString(_id); _id++; _node=OgreMascaretApplication::getInstance()->getSceneManager()->createSceneNode(name); OgreMascaretApplication::getInstance()->getSceneManager()->getRootSceneNode()->addChild(_node); setGlobalPosition(pos); setGlobalRotation(rotation); }
//---------------------------------------- void ofNode::rotateAround(const glm::quat& q, const glm::vec3& point) { // ofLogVerbose("ofNode") << "rotateAround(const glm::quat& q, const ofVec3f& point) not implemented yet"; // ofMatrix4x4 m = getLocalTransformMatrix(); // m.setTranslation(point); // m.rotate(q); setGlobalPosition(q * (getGlobalPosition() - point) + point); onOrientationChanged(); onPositionChanged(); }
//---------------------------------------- void ofNode::orbitRad(float longitude, float latitude, float radius, const glm::vec3& centerPoint) { glm::quat q = glm::angleAxis(longitude, glm::vec3(0, 1, 0)) * glm::angleAxis(latitude, glm::vec3(1, 0, 0)); glm::vec4 p { 0.f, 0.f, 1.f, 0.f }; // p is a direction, not a position, so .w == 0 p = q * p; // rotate p on unit sphere based on quaternion p = p * radius; // scale p by radius from its position on unit sphere setGlobalPosition(centerPoint + p); setOrientation(q); onOrientationChanged(); onPositionChanged(); }
void ofxDraggableNode::customDraw() { setGlobalPosition(position); sphere.setRadius(radius); sphere.rotate(0.5, 0.0, 1.0, 0.0); material.setShininess(120); ofColor col = color; material.setSpecularColor(col); material.setAmbientColor(col); material.begin(); ofDrawSphere(radius);// sphere.draw(); material.end(); ofSetColor(0); //sphere.drawWireframe(); }
void GameBodyObject::simulate(float dT) { // Check if the scene node has been changed, other than by the physics system, // and update the physics transforms accordingly if (mNode != NULL) { if (prevGlobalPosition != mNode->_getDerivedPosition()) { setGlobalPosition(mNode->_getDerivedPosition()); } if (prevGlobalOrientation != mNode->_getDerivedOrientation()) { setGlobalOrientation(mNode->_getDerivedOrientation()); } } shapeSimulate(dT); }
//---------------------------------------- void ofNode::setGlobalPosition(float px, float py, float pz) { setGlobalPosition({px, py, pz}); }
//---------------------------------------- void ofNode::setGlobalPosition(float px, float py, float pz) { setGlobalPosition(ofVec3f(px, py, pz)); }
bool FileSystemActor::serializeToPb(PbBumpObject * pbObject) { assert(pbObject); // NOTE: if this actor is pileized, then sync the position of this actor to the pile if (isPileized()) { BumpObject * lastPileItem = pileizedPile->getLastItem(); assert(lastPileItem); if (lastPileItem) { Vec3 pos = lastPileItem->getGlobalPosition(); pos.y = getGlobalPosition().z; setGlobalPosition(pos); } } // serialize the core actor properties if (!Actor::serializeToPb(pbObject)) return false; // write the full path pbObject->SetExtension(PbFileSystemActor::full_path, stdString(getFullPath())); // write the launch override path pbObject->SetExtension(PbFileSystemActor::launch_override_path, stdString(getLaunchOverride())); // write the texture override path QString overrideTexturePath; getTextureOverride(overrideTexturePath); pbObject->SetExtension(PbFileSystemActor::texture_override_path, stdString(overrideTexturePath)); // write the pilelized state bool pileized = (pileizedPile != NULL); pbObject->SetExtension(PbFileSystemActor::pileized, pileized); // write the thumbnail state pbObject->SetExtension(PbFileSystemActor::thumbnailized, useThumbnail); // write the launch count pbObject->SetExtension(PbFileSystemActor::launch_count, useThumbnail); // NOTE: if the actor was pileized, then push it back underground if (isPileized()) PushBelowGround(this); // write all the cached previous children sizes if this filesystem actor was pileized if (isFileSystemType(Folder)) { QHashIterator<QString, Vec3> iter(_prevPileizedActorDims); while (iter.hasNext()) { iter.next(); PbFileSystemActor_PbCachedFilePathDims * dims = pbObject->AddExtension(PbFileSystemActor::prev_pileized_children_dims); dims->set_file_path(stdString(iter.key())); toPbVec3(iter.value(), dims->mutable_dims()); } } return pbObject->IsInitialized(); }