
The code attached is the part that deals with creating and animating the ball, and one part of the mesh. Any help would be appreciated!
Code: Select all
scene::IAnimatedMesh* ball_node = smgr->addSphereMesh("ball", 6.7);
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(ball_node);
//scene::ISceneNode * node = smgr->addSphereSceneNode(6.7);
//scene::ISceneNode * node = smgr->addSphereSceneNode(.067);
if (node)
{
node->setPosition(core::vector3df(12, 5.485, 1));
node->setMaterialTexture(0, driver->getTexture("C:/Users/kgalane/Desktop/fun with meshes/tennisballjpg.jpg"));
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->addShadowVolumeSceneNode();
node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
core::array<core::vector3df> animation_points;
for (std::vector<BallPoint>::iterator iter = points.begin(); iter != points.end() ; iter++)
{
animation_points.push_back(core::vector3df((*iter).X, (*iter).Y, (*iter).Z));
}
ITimer * timer = Device->getTimer();
timer->setSpeed(15.0);
scene::ISceneNodeAnimator* anim = smgr->createFollowSplineAnimator(Device->getTimer()->getTime(), animation_points);
if (anim)
{
node->addAnimator(anim);
anim->drop();
}
}
scene::IAnimatedMesh* north_mesh = smgr->getMesh("C:/Users/kgalane/Desktop/fun with meshes/Court_Grass_North_ALT.obj");
if (!north_mesh)
{
Device->drop();
return 1;
}
scene::IAnimatedMeshSceneNode* north_mesh_node = smgr->addAnimatedMeshSceneNode(north_mesh);
if (north_mesh_node)
{
north_mesh_node->setMaterialFlag(video::EMF_LIGHTING, true);
north_mesh_node->setMaterialTexture(0, driver->getTexture(".../fun with meshes/tex/Court_North_Grass.png"));
north_mesh_node->setMaterialType(EMT_SOLID);
north_mesh_node->setMaterialFlag(EMF_BACK_FACE_CULLING , false );
north_mesh_node->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);
}