summaryrefslogtreecommitdiff
path: root/src/clientobject.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-10 04:15:10 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-10 04:15:10 +0300
commitfd7a0735c9aeaa7978190049319e3cdfe48920a4 (patch)
tree655709280d2940de54bd489a24821a158cea787d /src/clientobject.cpp
parentc0f0c6568bb45350e65f31476578feff879831bf (diff)
downloadminetest-fd7a0735c9aeaa7978190049319e3cdfe48920a4.tar.gz
minetest-fd7a0735c9aeaa7978190049319e3cdfe48920a4.tar.bz2
minetest-fd7a0735c9aeaa7978190049319e3cdfe48920a4.zip
new object system
Diffstat (limited to 'src/clientobject.cpp')
-rw-r--r--src/clientobject.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/clientobject.cpp b/src/clientobject.cpp
index d95862d1d..a6aa033ef 100644
--- a/src/clientobject.cpp
+++ b/src/clientobject.cpp
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "porting.h"
#include "constants.h"
#include "utility.h"
+#include "environment.h"
core::map<u16, ClientActiveObject::Factory> ClientActiveObject::m_types;
@@ -148,7 +149,7 @@ void TestCAO::updateNodePos()
//m_node->setRotation(v3f(0, 45, 0));
}
-void TestCAO::step(float dtime)
+void TestCAO::step(float dtime, ClientEnvironment *env)
{
if(m_node)
{
@@ -187,7 +188,7 @@ ItemCAO proto_ItemCAO;
ItemCAO::ItemCAO():
ClientActiveObject(0),
- m_selection_box(-BS*0.4,0.0,-BS*0.4, BS*0.4,BS*0.8,BS*0.4),
+ m_selection_box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.),
m_node(NULL),
m_position(v3f(0,10*BS,0))
{
@@ -219,10 +220,10 @@ void ItemCAO::addToScene(scene::ISceneManager *smgr)
video::S3DVertex(BS/2,-BS/4,0, 0,0,0, c, 1,1),
video::S3DVertex(BS/2,BS/4,0, 0,0,0, c, 1,0),
video::S3DVertex(-BS/2,BS/4,0, 0,0,0, c, 0,0),*/
- video::S3DVertex(BS/3,0,0, 0,0,0, c, 0,1),
- video::S3DVertex(-BS/3,0,0, 0,0,0, c, 1,1),
- video::S3DVertex(-BS/3,0+BS*2/3,0, 0,0,0, c, 1,0),
- video::S3DVertex(BS/3,0+BS*2/3,0, 0,0,0, c, 0,0),
+ video::S3DVertex(BS/3.,0,0, 0,0,0, c, 0,1),
+ video::S3DVertex(-BS/3.,0,0, 0,0,0, c, 1,1),
+ video::S3DVertex(-BS/3.,0+BS*2./3.,0, 0,0,0, c, 1,0),
+ video::S3DVertex(BS/3.,0+BS*2./3.,0, 0,0,0, c, 0,0),
};
u16 indices[] = {0,1,2,2,3,0};
buf->append(vertices, 4, indices, 6);
@@ -272,12 +273,17 @@ void ItemCAO::updateNodePos()
m_node->setPosition(m_position);
}
-void ItemCAO::step(float dtime)
+void ItemCAO::step(float dtime, ClientEnvironment *env)
{
if(m_node)
{
- v3f rot = m_node->getRotation();
+ /*v3f rot = m_node->getRotation();
rot.Y += dtime * 120;
+ m_node->setRotation(rot);*/
+ LocalPlayer *player = env->getLocalPlayer();
+ assert(player);
+ v3f rot = m_node->getRotation();
+ rot.Y = 180.0 - (player->getYaw());
m_node->setRotation(rot);
}
}