Exemple #1
0
const Zeni::Vector3f Utils::getSurfaceNormal(const Zeni::Point3f &p1, const Zeni::Point3f &p2, const Zeni::Point3f &p3) {
	Zeni::Vector3f v1 = p2 - p1;
	Zeni::Vector3f v2 = p3 - p2;
	Zeni::Vector3f normal = Zeni::Vector3f();
	normal.i = (v1.y * v2.z) - (v1.z * v2.y);
	normal.j = (v1.z * v2.x) - (v1.x * v2.z);
	normal.k = (v1.x * v2.y) - (v1.y * v2.x);
	return normal.normalize();
}
void Energy::Update (Zeni::Time::Second_Type elapsedTime)
{
    Zeni::Point2f hero = HeroComponent::GetInstance().GetPosition();
    Zeni::Vector3f a (hero.x - position.x, hero.y - position.y, 0.0f);
    a.normalize();

    SetAcceleration (100.0f * a);

    Simulateable::UpdatePosition (elapsedTime);
}