changeset 12:d45a95c697c3

add GiantrobClassfile.
author tokumoritaichirou@w-133-13-243-110.cc.u-ryukyu.ac.jp
date Wed, 03 Feb 2010 18:33:08 +0900
parents 4727e16018cd
children 39e0c583e0a3
files src/GameManager.cpp src/GameManager.h src/Robot.cpp
diffstat 3 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/GameManager.cpp	Wed Feb 03 12:02:57 2010 +0900
+++ b/src/GameManager.cpp	Wed Feb 03 18:33:08 2010 +0900
@@ -109,7 +109,7 @@
 
 	sTick = osg::Timer::instance()->tick();	
 
-	Robot* movObj = new Robot("robo2");
+	Giantarm* movObj = new Giantarm("robo2");
 	//movObj->setPos(osg::Vec3(-10,0,0));
 	movObj->setDefaultDirection(osg::Vec3(0.0, 0.0, 90));
 	movObj->setAvatarDirection(-1);
--- a/src/GameManager.h	Wed Feb 03 12:02:57 2010 +0900
+++ b/src/GameManager.h	Wed Feb 03 18:33:08 2010 +0900
@@ -41,6 +41,7 @@
 #include "PlayerEyePoint.h"
 #include "KeyboardEventHandler.h"
 #include "Robot.h"
+#include "Giantarm.h"
 #include "CollisionDetector.h"
 #include "Player.h"
 
--- a/src/Robot.cpp	Wed Feb 03 12:02:57 2010 +0900
+++ b/src/Robot.cpp	Wed Feb 03 18:33:08 2010 +0900
@@ -38,25 +38,25 @@
 	bodyForm->setMatrix(osg::Matrix());
 
 	collisionNode = new CollisionNode("Body-Node1", new osg::Sphere(osg::Vec3(0, 0, 0), 50));
-	//bodyForm->addChild(collisionNode->getGeode());
+	bodyForm->addChild(collisionNode->getGeode());
 	collisionNodeList.push_back(collisionNode);
 	collisionNode = new CollisionNode("Body-Node2", new osg::Sphere(osg::Vec3(0, 0, 60), 50));
-	//bodyForm->addChild(collisionNode->getGeode());
+	bodyForm->addChild(collisionNode->getGeode());
 	collisionNodeList.push_back(collisionNode);
 	collisionNode = new CollisionNode("Body-Node3", new osg::Sphere(osg::Vec3(0, 0, -60), 50));
-	//bodyForm->addChild(collisionNode->getGeode());
+	bodyForm->addChild(collisionNode->getGeode());
 	collisionNodeList.push_back(collisionNode);
 	collisionNode = new CollisionNode("Left-Arm-Node", new osg::Sphere(osg::Vec3(100, -40, -70), 30));
-	//leftUpperArmForm->addChild(collisionNode->getGeode());
+	leftUpperArmForm->addChild(collisionNode->getGeode());
 	collisionNodeList.push_back(collisionNode);
 	collisionNode = new CollisionNode("Right-Arm-Node", new osg::Sphere(osg::Vec3(-100, -40, -70), 30));
-	//rightUpperArmForm->addChild(collisionNode->getGeode());
+	rightDownArmForm->addChild(collisionNode->getGeode());
 	collisionNodeList.push_back(collisionNode);
 	collisionNode = new CollisionNode("Left-Leg-Node", new osg::Sphere(osg::Vec3(0, 0, 0), 30));
-	//leftUpperLegForm->addChild(collisionNode->getGeode());
+	leftUpperLegForm->addChild(collisionNode->getGeode());
 	collisionNodeList.push_back(collisionNode);
 	collisionNode = new CollisionNode("Right-Leg-Node", new osg::Sphere(osg::Vec3(0, 0, 0), 30));
-	//rightUpperLegForm->addChild(collisionNode->getGeode());
+	rightUpperLegForm->addChild(collisionNode->getGeode());
 	collisionNodeList.push_back(collisionNode);	
 
 	SearchGeodeVisitor gvisitor = SearchGeodeVisitor();
@@ -217,14 +217,14 @@
 void Robot::punch() {
 	float sinVal = sin(moveCount);
 	float cosVal = cos(moveCount);
-	double punch[6][3] = {{5.0,-30.0,-30.0},{10.0,-30.0,-90.0},{15.0,-120.0,60.0}};
+	double punch[6][3] = {{5.0,-30.0,-30.0},{10.0,-90.0,-90.0},{15.0,-90.0,60.0},{15.0,-90.0,60.0},{10.0,-90.0,-90.0},{0.0,0.0,0.0}};
 	osg::Matrixd roteMatrix;
 	osg::Matrixd dirMatrix;
 	osg::Matrixd accMatrix;
 	
-	bodyForm->setMatrix(osg::Matrixf::rotate(osg::DegreesToRadians(punch[(int)moveCount%3][0]), osg::Vec3(0,0,1)));
-	rightUpperArmForm->setMatrix(osg::Matrixf::rotate(osg::DegreesToRadians(punch[(int)moveCount%3][1]), osg::Vec3(1,0,0)));
-	rightDownArmForm->setMatrix(osg::Matrixf::rotate(osg::DegreesToRadians(punch[(int)moveCount%3][2]), osg::Vec3(1,0,0)));
+	bodyForm->setMatrix(osg::Matrixf::rotate(osg::DegreesToRadians(punch[(int)moveCount%6][0]), osg::Vec3(0,0,1)));
+	rightUpperArmForm->setMatrix(osg::Matrixf::rotate(osg::DegreesToRadians(punch[(int)moveCount%6][1]), osg::Vec3(1,0,0)));
+	rightDownArmForm->setMatrix(osg::Matrixf::rotate(osg::DegreesToRadians(punch[(int)moveCount%6][2]), osg::Vec3(1,0,0)));
 	moveCount += 1;
 	//if(moveCount <= 0.5){
 		//bodyForm->setMatrix(osg::Matrixf::rotate(osg::DegreesToRadians(sinVal*10.0), osg::Vec3(0,0,1)));
@@ -275,7 +275,7 @@
 }
 
 void Robot::stop() {
-	//moveCount = 0;
+	moveCount = 0;
 	motionTime = 0;
 	velocity = osg::Vec3(0,0,0);
 	angularVelocity = osg::Vec3(0,0,0);