本文整理匯總了Java中com.badlogic.gdx.math.Vector2.rotate方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector2.rotate方法的具體用法?Java Vector2.rotate怎麽用?Java Vector2.rotate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.math.Vector2
的用法示例。
在下文中一共展示了Vector2.rotate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: process
import com.badlogic.gdx.math.Vector2; //導入方法依賴的package包/類
@Override
protected void process(E e) {
Vector2 gravityVector = v.set(e.planetboundGravity());
if (e.massInverse()) {
gravityVector.rotate(180);
}
// apply gravity.
Physics physics = e.getPhysics();
// don't move through solid matter.
PlanetCell cell = e.planetboundCell();
if (cell != null && cell.type != null && (cell.type.density == null || cell.type.density >= e.massDensity())) {
if (cell.type.flows() && !e.hasDolphinized()) {
gravityVector.rotate(180);
physics.vx = 0;
physics.vy = 0;
} else {
gravityVector.set(0, 0);
physics.vx = 0;
physics.vy = 0;
}
}
boolean inSpace = cell == null || cell.depth() <= 0;
physics.vx += gravityVector.x * (inSpace ? 0.5f : 4f);
physics.vy += gravityVector.y * (inSpace ? 0.5f : 4f);
if (inSpace) {
e.angleRotation(gravityVector.angle()-90);
}
physics.friction = 0.05f;
}