Game Development Community

Creating Collision polygons in code. [resolved]

by Cosmic Logic · in Torque X 2D · 06/19/2009 (11:14 pm) · 2 replies

Is this possible?

I've been playing with trying to make T2DCollisionImages and using the T2DSceneObject.Collision.InstallImage method but no luck so far.

I'll keep playing in the mean time, but if anyone knows how that would be awesome :)

#1
06/20/2009 (5:03 pm)
T2DPolyImage Poly = new T2DPolyImage(_Sprite);

 Poly.CollisionPolyBasis = new Vector2[7] { 
      new Vector2( 0.14677f, -0.66443f),
      new Vector2( 0.60440f,  0.56309f),
      new Vector2( 0.42161f,  0.83290f),
      new Vector2(-0.47336f,  0.83290f),
      new Vector2(-0.62198f,  0.55556f),
      new Vector2(-0.17808f, -0.67114f),
      new Vector2(-0.02857f, -0.79661f)};

 _Sprite.Collision.InstallImage(Poly);
#2
06/21/2009 (9:57 pm)
Beautiful :D Thank you.