當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector3.set方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.math.Vector3.set方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector3.set方法的具體用法?Java Vector3.set怎麽用?Java Vector3.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.math.Vector3的用法示例。


在下文中一共展示了Vector3.set方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: touchInRectangle

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
public static boolean touchInRectangle(Rectangle r, OrthographicCamera camera) {
if (Gdx.input.isTouched()) {
    Vector3 touchPos = new Vector3();
    touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
    camera.unproject(touchPos);
    return r.x <= touchPos.x && r.x + r.width >= touchPos.x
	    && r.y <= touchPos.y && r.y + r.height >= touchPos.y;
}
return false;
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:11,代碼來源:Utils.java

示例2: unproject

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
/**
 * Convert the specified point of screen-space coordinate into the 3D world-space coordinate.
 *
 * Origin point at left top corner in screen-space.
 * @param size The window size to use.
 * @param src  The screen-space position.
 * @param dst  The 3D world-space position.
 */
public void unproject( Size size,  Vector3 src, Vector3 dst) {
	Vector3 screen = pool_vec3.set(src.x / size.width, ((size.height - src.y)) / size.height, src.z);
 screen.x = screen.x * 2.0f - 1.0f;
 screen.y = screen.y * 2.0f - 1.0f;
 screen.z = screen.z * 2.0f - 1.0f;
 
 projectionInv.set(getViewProjectionMatrix());
 projectionInv.inv();
 
 screen.mul(projectionInv);
 dst.set(screen);
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:21,代碼來源:Camera.java

示例3: unprojectGL

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
/**
 * Convert the specified point of GL-screen-space coordinate into the 3D world-space coordinate.
 *
 * Origin point at left bottom corner in GL-screen-space.
 * @param size The window size to use.
 * @param src  The GL-screen-space position.
 * @param dst  The 3D world-space position.
 */
public void unprojectGL(Size size,  Vector3 src, Vector3 dst) {
	Vector3 screen = pool_vec3.set(src.x / size.width, src.y / size.height, src.z);
 screen.x = screen.x * 2.0f - 1.0f;
 screen.y = screen.y * 2.0f - 1.0f;
 screen.z = screen.z * 2.0f - 1.0f;
 
 projectionInv.set(getViewProjectionMatrix());
 projectionInv.inv();
 
 screen.mul(projectionInv);
 dst.set(screen);
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:21,代碼來源:Camera.java

示例4: update

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
@Override
public void update(float gameTime) {

	float oldXPosition = getX();
	
	if(Utils.isKeyDown(Keys.RIGHT))
	{
		setX(getX() + 10) ;
	}
	
	if(Utils.isKeyDown(Keys.LEFT))
	{
		setX(getX() - 10);
	}
	
	final Vector3 touchPos = new Vector3();
       touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
       getGameService().getCamera().unproject(touchPos);
       setX(touchPos.x - 64 / 2);
       //if bucker out of screen bound, restore its position
       if(getX() < 0 || getX() > Gdx.graphics.getWidth() - getRegionWidth() )
	{
		setX(oldXPosition);
	}
	
	for(Drop drop : drops)
	if(getBoundingRectangle().overlaps(drop.getBound()))
	{
		score++;
		drop.resetPosition();
	}
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:33,代碼來源:Bucker.java

示例5: getPosition3D

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
/**
 * returns the position (X,Y,Z) in its parent's coordinate system
 */
public Vector3 getPosition3D(Vector3 ret) {
	return ret.set(_position.x, _position.y, _positionZ);
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:7,代碼來源:Node.java

示例6: getRotation3D

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
public Vector3 getRotation3D(final Vector3 ret) {
	return ret.set(_rotationX, _rotationY, _rotationZ);
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:4,代碼來源:Node.java

示例7: rotateX

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
public static Vector3 rotateX(Vector3 vec, float angRad) {
    float sin = sin(angRad);
    float cos = cos(angRad);
    return vec.set(vec.x, vec.y * cos - vec.z * sin, vec.z * cos + vec.y * sin);
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:6,代碼來源:VectorUtil.java

示例8: rotateY

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
public static Vector3 rotateY(Vector3 vec, float angRad) {
    float sin = sin(angRad);
    float cos = cos(angRad);
    return vec.set(vec.z * sin + vec.x * cos, vec.y, vec.z * cos - vec.x * sin);
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:6,代碼來源:VectorUtil.java

示例9: rotateZ

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
public static Vector3 rotateZ(Vector3 vec, float angRad) {
    float sin = sin(angRad);
    float cos = cos(angRad);
    return vec.set(vec.x * cos - vec.y * sin, vec.x * sin + vec.y * cos, vec.z);
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:6,代碼來源:VectorUtil.java

示例10: averageInto

import com.badlogic.gdx.math.Vector3; //導入方法依賴的package包/類
public static Vector3 averageInto(Vector3 first, Vector3 second) {
    return first.set((first.x + second.x) / 2.0F, (first.y + second.y) / 2.0F, (first.z + second.z) / 2.0F);
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:4,代碼來源:VectorUtil.java


注:本文中的com.badlogic.gdx.math.Vector3.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。