0
点赞
收藏
分享

微信扫一扫

澎湃算力 玩转AI 华为昇腾AI开发板——香橙派OriengePi AiPro边缘计算案例评测

    

前几日写了一个小DEMO用到键盘用ASDW等按键控制一个物体的上下左右移动和旋转等操作。

这个是一个非常基础的简单控制,但是查询官方文档也是很吃力。

因此,分享在此处,方便大家不用闭门造车,重复造车。

使用注意:

1:移动旋转速度,自行控制

2:我的代码操作的是mSelectedNode,这个节点对象请自行准备。

代码运行版本Unigine2.5 

但相信可以作用在几乎所有的Unigine版本中。因为都是基础操作函数。

int AppWorldLogic::update()

{

//设置旋转和移动的速度
    Unigine::App* app = Unigine::App::get();
    float movement_speed = 5.0;
    float rotation_speed = 5.0f;

    //有当前对象才操作
    if (mSelectedNode)
    {
        Vec3 oldPos = mSelectedNode->getPosition();
        // get the frame duration
        float ifps = Game::get()->getIFps();
        // get the current world transformation matrix of the mesh
        Mat4 transform = mSelectedNode->getWorldTransform();
        // get the direction vector of the mesh

举报

相关推荐

0 条评论