Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ADDED: translation + rotation for buoys. Les bouées partent n'importe…

… où!!
  • Loading branch information...
commit a0a22485567ef03652a06329df6a1a5167ec679e 1 parent 6573735
@gnuvince authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 Application/Sources/Scene/Buoy.cpp
View
16 Application/Sources/Scene/Buoy.cpp
@@ -93,13 +93,26 @@ void Buoy::Animate( const WaterSurface& waterSurface, real time, real dt )
// retourne la normale de l'eau dans le repère
// global.
///////////////////////////////////////
+
+ // Hauteur
+ Vector3<real> global_position = GetLocalToGlobal() * Vector3<real>(0,0,0);
+ Vector3<real> water_position = waterSurface.GetGlobalWithHeight(global_position);
+ Transformation<real> t = GetLocalTransformation();
+ t.Translate(GetGlobalToLocal() * water_position);
+
+ // Orientation
+ Vector3<real> water_orientation = waterSurface.GetGlobalNormal(global_position);
+ t.RotateX(dt * atan(water_orientation.X() / water_orientation.Z()));
+ t.RotateZ(dt * atan(water_orientation.Z() / water_orientation.Y()));
+
+ SetLocalTransformation(t);
}
real Buoy::GetRadius() const
{
// Vous pouvez remplacer cette valeur au besoin.
//Elle doit correspondre au rayon de la base de la bouée
- return 0.5;
+ return 1;
}
void Buoy::OnCollide()
@@ -111,6 +124,7 @@ void Buoy::OnCollide()
// appelée lorsque la bouée entre en
// collision.
///////////////////////////////////////
+ mFlag.SetMaterial(&mBaseMaterial);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.