当前位置: 首页>>代码示例>>Java>>正文


Java Quaternion.getAxisAngle方法代码示例

本文整理汇总了Java中com.badlogic.gdx.math.Quaternion.getAxisAngle方法的典型用法代码示例。如果您正苦于以下问题:Java Quaternion.getAxisAngle方法的具体用法?Java Quaternion.getAxisAngle怎么用?Java Quaternion.getAxisAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.math.Quaternion的用法示例。


在下文中一共展示了Quaternion.getAxisAngle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: click

import com.badlogic.gdx.math.Quaternion; //导入方法依赖的package包/类
public void click(int button) {
        if (button == 6) {
            logger.info("Freeze!");
            for (WorldEntity entity : entities) {
                entity.btRigidBody.clearForces();
                entity.btRigidBody.setAngularVelocity(new Vector3(0, 0, 0));
                entity.btRigidBody.setLinearVelocity(new Vector3(0, 0, 0));

            }
        }


        if (lastHovered == null) {
            return;
        }

        if (button == 3) {
            Quaternion rotation = new Quaternion();
            lastHovered.btRigidBody.getCenterOfMassTransform().getRotation(rotation);
            Vector3 rot = new Vector3();
            float axisAngle = rotation.getAxisAngle(rot);
            Vector3 rotate = new Vector3(0f, 0, 10).rotate(rot, axisAngle);
//            lastHovered.btRigidBody.applyCentralForce(rotate);
            lastHovered.btRigidBody.applyForce(new Vector3(5, 0, 0), new Vector3(0, 0f, 2.5f));
        } else if (button == 4) {
//            lastHovered.btRigidBody.applyCentralImpulse(new Vector3(0, 0, 50f));
            lastHovered.btRigidBody.applyTorqueImpulse(new Vector3(0, 5, 0f));
        } else if (button == 5) {
            lastHovered.btRigidBody.applyTorqueImpulse(new Vector3(0, 0, 500f));
        }

    }
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:33,代码来源:World.java

示例2: SimulationData

import com.badlogic.gdx.math.Quaternion; //导入方法依赖的package包/类
public SimulationData(WheelWorld wheelWorld) {


        position = new Vector3(wheelWorld.rim.rigidBody.getCenterOfMassPosition());


        Quaternion q = new Quaternion();
        rotation = new Vector3();
        wheelWorld.rim.rigidBody.getCenterOfMassTransform().getRotation(q);
        float f = q.getAxisAngle(rotation);
        rotation.scl(f);

        spokeForces = new float[wheelWorld.spokes.size()];

        for (int i = 0; i < wheelWorld.spokes.size(); i++) {
            spokeForces[i] = wheelWorld.spokes.get(i).currentForce;
        }

    }
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:20,代码来源:SimulationData.java


注:本文中的com.badlogic.gdx.math.Quaternion.getAxisAngle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。