• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BetterCharacterControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jme3.bullet.control.BetterCharacterControl的典型用法代码示例。如果您正苦于以下问题:Java BetterCharacterControl类的具体用法?Java BetterCharacterControl怎么用?Java BetterCharacterControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BetterCharacterControl类属于com.jme3.bullet.control包,在下文中一共展示了BetterCharacterControl类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onLocationUpdated

import com.jme3.bullet.control.BetterCharacterControl; //导入依赖的package包/类
@Override
protected void onLocationUpdated(Vector3f location) {
    RigidBodyControl control = target.getSpatial().getControl(RigidBodyControl.class);
    if (control != null) {
        control.setPhysicsLocation(location);
        // 重新激活物理特性,当物体不再运动时物理引擎会让它进入睡眠,以节省性能。
        // 这里要确保重新激活,以便在编辑的时候可以重新看到物理效果的影响
        control.activate();
    }
    BetterCharacterControl character = target.getSpatial().getControl(BetterCharacterControl.class);
    if (character != null) {
        character.warp(location);
    }
    target.getSpatial().setLocalTranslation(location);
    target.updateDatas();
    notifyPropertyChanged("location", location);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:18,代码来源:SimpleModelEntityControlTile.java


示例2: initialize

import com.jme3.bullet.control.BetterCharacterControl; //导入依赖的package包/类
@Override
public void initialize() {
    super.initialize();
    
    // 对于一些没有“Wait动画”的角色必须想办法让它静止下来
    if (animation == null) {
        channelModule.reset();
    }
    // 清除角色的移动量
    BetterCharacterControl bcc = actor.getSpatial().getControl(BetterCharacterControl.class);
    if (bcc != null) {
        bcc.setWalkDirection(new Vector3f());
    }
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:15,代码来源:WaitSkill.java


示例3: initialize

import com.jme3.bullet.control.BetterCharacterControl; //导入依赖的package包/类
@Override
public void initialize() {
    super.initialize();
    channelModule = actor.getModule(ChannelModule.class);
    jumpIntensityAttribute = actor.getAttribute(bindJumpIntensityAttribute, NumberAttribute.class);
    
    // JumpStart动画
    if (!animStartPlayed) {
        animStartPlayed = true;
        if (animStart != null) {
            channelModule.playAnim(animStart, null, LoopMode.DontLoop, useTimeInStart , 0);
        }
    }
    
    bcc = actor.getSpatial().getControl(BetterCharacterControl.class);
    if (bcc != null) {
        // 获取物理控制器,并记住跳跃之前角色的移动方向,跳跃之前必须先将角色的移动清0。
        // 因为这个WalkDirection是持续的作用力过程,会造成跳跃空中时,如果遇到障碍物有可能会导致角色紧贴着物体不会落下
        // 或者遇到障碍物后这个力仍然一直推着角色向前滑动的bug.
        lastWalkDirection.set(bcc.getWalkDirection());
        bcc.setWalkDirection(new Vector3f());
        
        //  记住这个阻尼值,当角色在跳跃时这个值必须清0,否则会导致很难跳起来。在角色跳到空中后,这个设置可以还原。
        lastPhysicsDamping = bcc.getPhysicsDamping();
    } else {
        LOG.log(Level.WARNING, "Jump failure! BetterCharacterControl not found from Entity, entityId={0}, uniqueId={1}"
                    , new Object[] {actor.getData().getId(), actor.getData().getUniqueId()});
    }
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:30,代码来源:JumpSkill.java


示例4: checkState

import com.jme3.bullet.control.BetterCharacterControl; //导入依赖的package包/类
@Override
public int checkState() {
    bcc = actor.getSpatial().getControl(BetterCharacterControl.class);
    if (bcc == null || !bcc.isOnGround()) {
        return StateCode.SKILL_USE_FAILURE;
    }
    return super.checkState();
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:9,代码来源:JumpSkill.java


示例5: install

import com.jme3.bullet.control.BetterCharacterControl; //导入依赖的package包/类
@Override
public void install(Prefab parent) {
    this.parent = parent;
    characterControl = new BetterCharacterControl(radius, height, mass);

    parent.addControl(characterControl);
    if (PhysicsSpace.getPhysicsSpace() != null) {
        PhysicsSpace.getPhysicsSpace().add(characterControl);
    }
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:11,代码来源:CharacterControllerComponent.java


示例6: ConstructCharacter

import com.jme3.bullet.control.BetterCharacterControl; //导入依赖的package包/类
private void ConstructCharacter(){
        Spatial playerSpatial = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
        player =  (Node)playerSpatial;
        Node playerNode = new Node();
        playerNode.attachChild(player);
        player.move(0,3.5f,0);
        player.setLocalScale(0.5f);
        //rootNode.attachChild(player);
        /* Load the animation controls, listen to animation events,
     * create an animation channel, and bring the model in its default position.  */
////        control = player.getControl(AnimControl.class);
////        control.addListener(this);
////        channel = control.createChannel();
////        channel.setAnim("stand");
//        CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
//        CharacterControl playerControl = new CharacterControl(capsuleShape, 0.01f);
        playerControl = new BetterCharacterControl(1.5f, 6f, 1f);
//        player.addControl(playerControl);
        playerNode.addControl(playerControl);
//        playerControl.setJumpSpeed(10f);
        playerControl.setJumpForce(new Vector3f(0,5f,0));
//        playerControl.setFallSpeed(20f);
//        playerControl.setGravity(1f);
        playerControl.setGravity(new Vector3f(0,1f,0));
        // Finally we put the player in its starting position and update its state – remember to use setPhysicsLocation() instead of setLocalTranslation() now, since you are dealing with a physical object.
        playerControl.warp(new Vector3f(0,10,10));
        // We need to register all solid objects to the PhysicsSpace!
        bulletAppState.getPhysicsSpace().add(playerControl);
        bulletAppState.getPhysicsSpace().addAll(playerNode);
        rootNode.attachChild(playerNode);
//        SkeletonDebugger skeletonDebug = ConstructSkeleton();
//        player.attachChild(skeletonDebug);
        
         animationControl = player.getControl(AnimControl.class);
        animationControl.addListener(this);
        animationChannel = animationControl.createChannel();
        attackChannel = animationControl.createChannel();
        attackChannel.addBone(animationControl.getSkeleton().getBone("uparm.right"));
        attackChannel.addBone(animationControl.getSkeleton().getBone("arm.right"));
        attackChannel.addBone(animationControl.getSkeleton().getBone("hand.right"));
    }
 
开发者ID:devinbost,项目名称:jMathGame3d,代码行数:42,代码来源:HelloJME3.java


示例7: ConstructCharacter

import com.jme3.bullet.control.BetterCharacterControl; //导入依赖的package包/类
private void ConstructCharacter(){
        Spatial playerSpatial = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
        player =  (Node)playerSpatial;
        playerNode = new Node();
        playerNode.attachChild(player);
        player.move(0,3.5f,0);
        player.setLocalScale(0.5f);
        //rootNode.attachChild(player);
        /* Load the animation controls, listen to animation events,
     * create an animation channel, and bring the model in its default position.  */
////        control = player.getControl(AnimControl.class);
////        control.addListener(this);
////        channel = control.createChannel();
////        channel.setAnim("stand");
//        CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
//        CharacterControl playerControl = new CharacterControl(capsuleShape, 0.01f);
        playerControl = new BetterCharacterControl(1.5f, 6f, 1f);
//        player.addControl(playerControl);
        playerNode.addControl(playerControl);
//        playerControl.setJumpSpeed(10f);
        playerControl.setJumpForce(new Vector3f(0,5f,0));
//        playerControl.setFallSpeed(20f);
//        playerControl.setGravity(1f);
        playerControl.setGravity(new Vector3f(0,1f,0));
        // Finally we put the player in its starting position and update its state – remember to use setPhysicsLocation() instead of setLocalTranslation() now, since you are dealing with a physical object.
        playerControl.warp(new Vector3f(0,10,10));
        // We need to register all solid objects to the PhysicsSpace!
        bulletAppState.getPhysicsSpace().add(playerControl);
        bulletAppState.getPhysicsSpace().addAll(playerNode);
        rootNode.attachChild(playerNode);
//        SkeletonDebugger skeletonDebug = ConstructSkeleton();
//        player.attachChild(skeletonDebug);
        
         animationControl = player.getControl(AnimControl.class);
        animationControl.addListener(this);
        animationChannel = animationControl.createChannel();
        attackChannel = animationControl.createChannel();
        attackChannel.addBone(animationControl.getSkeleton().getBone("uparm.right"));
        attackChannel.addBone(animationControl.getSkeleton().getBone("arm.right"));
        attackChannel.addBone(animationControl.getSkeleton().getBone("hand.right"));
    }
 
开发者ID:devinbost,项目名称:jMathGame3d,代码行数:42,代码来源:Main.java


示例8: installGameComponent

import com.jme3.bullet.control.BetterCharacterControl; //导入依赖的package包/类
@Override
public void installGameComponent(Spatial parent)
{
    characterControl = new BetterCharacterControl(radius, height, mass);
    parent.addControl(characterControl);
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:7,代码来源:CharacterControllerComponent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AvailabilityType类代码示例发布时间:2022-05-23
下一篇:
Java SmartList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap