Angel between
by PeterB · in Torque Game Builder · 10/29/2007 (11:04 am) · 1 replies
I must not understand something fundamental because I'm confused by what should be easy. I want to push a sprite in the opposite direction of where I click, but for simplicity, let's say it'll go in the same direction. Here is what I do:
%mousePos = $TheSelector.getPosition(); // sprite that's locked to the mouse
%myPos = %this.owner.getPosition();
%angle = t2dAngleBetween(%mousePos, %myPos);
%this.owner.setImpulseForcePolar(%angle, 50);
The values for '%angle' seem completely about distance, not angle.
%mousePos = $TheSelector.getPosition(); // sprite that's locked to the mouse
%myPos = %this.owner.getPosition();
%angle = t2dAngleBetween(%mousePos, %myPos);
%this.owner.setImpulseForcePolar(%angle, 50);
The values for '%angle' seem completely about distance, not angle.
About the author
Torque Owner PeterB
http://www.garagegames.com/mg/forums/result.thread.php?qt=61293