ssatguru / babylonjs-charactercontroller Goto Github PK
View Code? Open in Web Editor NEWA CharacterController for BabylonJS
License: Apache License 2.0
A CharacterController for BabylonJS
License: Apache License 2.0
in ie 11 jump using space bar and movement using arrow keys don't work.
This is because the new version of controller uses key rather than keycode to capture keyevents.
ie returns "Spacebar" rather than " " (returned by other browsers) for space key press
Also internet Explorer, Edge (16 and earlier), and Firefox (36 and earlier) use "Left", "Right", "Up", and "Down" instead of "ArrowLeft", "ArrowRight", "ArrowUp", and "ArrowDown".
Hi,
I tried your CharacterController which works rather well, but we can only add predefined animation (like walking, running, jumping ...)
Can we add other animations like: punch, kick, sit, push, pick up, pull. We are quite limited now, we can not do a fighting game for example.
It would be great to have other possibilities of animation and possibilities to add other keyboard commands.
This is the only limit I currently find
Thanks
Currently the controller expects the character mesh to be created and animated facing the negative z direction. In other words in Rest Pose the character should be facing the negative z direction.
We should support character mesh facing the positive z direction too
Hi. Thanks for sharing this great controller.
I upgraded my previous controller version 0.1.0 to 0.4.3 with the avatars in the demo site opened.
I found that the avatars looked too dark (both Vincent, and Npc) in the demo site. They look almost black when I look at the shadowed side without lighting in my web site.
The avatars in the old version looked pretty bright and clearly visible from all directions even without light. It seems that something changed about the brightness of avatars in version 0.4.3 (or before it).
How can I change the brightness of the avatars? I don't use any mesh editor, and I hope that there is an easy way to change brightness of a loaded mesh.
Thanks in advance.
api only stop methods? hot to destory?
Hi,
There is a small bug in updateTargetValue.:
private _updateTargetValue() { //donot move camera if av is trying to clinb steps if (this._vMoveTot == 0) this._avatar.position.addToRef(this._cameraTarget, this._camera.target);
Something is missing when you want the avatar to look in one direction or another as well as the camera with a different beta and alpha and radius.
Currently, my character can be anywhere on the terrain (it works on load), but the rotation of the character cannot be changed on scene load, nor can the beta, alpha and radius of the camera.
If I save the position, rotation of the player and the camera, so that when the player reloads the game later, he finds the same position and rotation, it does not work. only the position is taken into account, but the player will always look in the same direction and the camera will have an alpha and beta and radius always the same.
put another way. If I want to rotate my character when loading the game, it does not work. If I make my camera with a beta, alpha, radius in one way, it is not taken into account. because the updateTargetValue function re-modifies my values. The character has a default rotation as well as the arcRotateCamera.
How to correct this? Thanks.
There's a jitter of +-0.001-0.01(est.) when using calcMovePOV and moveWithCollision that becomes clear(er) when viewing contrasting-coloured meshes.
Anyone using CC for secondary player control? ie: not the player attached to the camera. I want to do that, but looks like camera controls are entangled a bit. I'll work on separating it out - unless anyone has already done so - or if you have a quick tip SSatGuru?
Hi!
Thanks for the cool asset first of all :)
I seem to have some problem integrating another model though.
https://sketchfab.com/3d-models/gorillamotions-b50cab2736c04d128f417f05008605fd
I tried the gltf, then converted it to .babylon but the same error: the root node is not a mesh.
I used the code from the demo scene to import the mesh and add the character controller.
however, when I check it out in babylon sandbox, I see that the root node is actually a mesh.
What may be the issue?
Hi,
When you walk while jumping, it works, but if you run, you can't jump at the same time.
Thanks
Currently pressing walk key AND shift makes the avatar run.
Similar pressing walkback key or strafeleft/right key or turn Left/Right key AND shift should make the avatar walk back or strafe Left/Right or turn Left/Right faster .
Hi all. I'm using pauseAnim() to play another animation (death animation).
All works fine - except that after the death animation is over, it reverts to the idle animation (but where none of the other animations will play). It does the same thing on Vincent model, so i dont think it's my GLB.
The only time it works is if i pause directly after doing cc.start(). Anytime later and it doesn't work.
I wonder, since pauseAnim only sets a property - does it need to do something more?
First off, I just wanted to say thanks for such a great, helpful repository! You rock!
Second, I was wondering what's the best way to tackle mobile support? I would love to be able to hold & drag my finger around the screen to walk, and pinch to zoom in/out. There's a good bablyonJS example here (load it on mobile to see what I mean): https://www.babylonjs.com/demos/sponza/
How can I implement such an option?
With GLB models srtafeLeft does right and strafeRight does left.
This due to the fact that babylonjs is left-handed and GLB models are right-handed
Hi there,
Really nice project, appreciate it. May I ask if my project is using BJS ES6 module, how can I get this lib to work without hard forking? Or is there any plan of adding BJS ES6 module support to this? Thank you in advance!!
Hello Guys, great work!, can the library used in unity to integrated with current project ?
Hello,
I wonder if it would not be interesting to add a "CarControler" in the same spirit and complementary to the "CharacterControler" . Which would complete this library of controllable objects. Then we could talk about the "FlyControler", but that would be for later. It should be even simpler than the CarControler.
I explain in more detail the idea.
The CarControler :
And without physics (type arcade like GTA doesIf you know this game)
The CharacterControler already has a good basis for making a CarControler. What do you think of the ideas?
I had idea to try to do it, but I have doubts, I think that it should remain in the same spirit as the CharacterControler and that it is to couple, so I ask you if you would be interested in doing it.
I am impatient to know what you think, your reactions, I would be very interested in this and I am sure that on the Babylon forum, many will find it great (I see a lot of little demos with cars)
I can then help you test it and give you feedback, improvements, bugs, help as best as I can. I think you have better programming skills than I do and I don't know much about typescript.
I may be able to help you find a 3D car model that would be used for testing, the final demo, unless you already have a 3D vehicle. Tell me how I can help you, don't hesitate.
Thanks in advance for reading me.
In the testAnimationGroup example which uses a .glb avatar, when scrolling to go into first person mode, it stops right before. If in the same example I change to the .babylon, it works just fine. I've tried with other .glb avatars and same issue. I'm not sure what's different.
Hi - just downloaded, npm installed and clicked "test animation group (using a .glb file)"
Character moves around, but does not change animation state (frozen state).
Haven't dived into it yet... but that's what i get on first install.
Works fine in .babylon format.
Just a thanks for putting together this character controller. It's awesome! So much hard work and attention to detail on it. Planning to use it for a "movie maker" that i'm working on (slowly) at dfilm.com.
cheers,
ben
I see PRs that have not been validated for some time and have even become obsolete.
I have done 2 PRs recently awaiting review. Is the CharacterControler still maintained ?
Thanks
the current method is not precise. raycast would be more precise. falls would be better handled.
Hi,
When you hold down the space bar, the jump is performed several times. Shouldn't it be done only once, even if you hold down the space key?
In addition, if I press Z + Shift to run and release both keys at the same time, the character walks without any keys activate. The reset was not done completely
Hi SSatGuru!
Any thoughts about using the CC with Havok physics. Ie: to be able to use Havok to detect character collisions? I've been trying to get it to work, but no luck. Thought you might have some better ideas. https://forum.babylonjs.com/t/character-controller-and-havok-collisions/42083/3
The current controller is good for third party or first person type of games.
It is not suitable for top down or isometric kind of games where the camera follows but does not rotate the character or rotates when the character rotates.
We should support both use cases.
I was looking at the Use characterController for secondary players #64 issue, which seems similar to what I'm trying to do. I'm setting up a server to verify movement, was curious if there was a way for this to work when the avatar meshes are just boxes without animations.
Thank you!
When will there be a Babylon.js 5.0 support?
Avatar movement is jerky when running and turning
currently, character can only be moved via keyboard.
we should provide methods to move character via code.
this would make it easy to add support for devices like touch joystick or move on mouse click etc
Add two new sub modes.
In one sub-mode the left and right keys should make the avatar turn left or right and the back key makes the avatar walk backward with back facing the camera.
In the other sub-mode the left and right keys should make the avatar face and move left or right and the back keys makes the avatar turn around and move towards the camera.
Trying character controller for the first time and attempting to merge it with the colyseus boilerplate (https://github.com/endel/colyseus-babylonjs-boilerplate)
I am seeing a reflection of the character as shown in the screenshot... I noticed this happens as soon as CharacterController.start(); is called.
Would appreciate any pointers to resolve this :)
There was jitter when performing the Walkback and trunRight operations, and I found that deleting "a = 1" worked fine.
In function _rotateAVnC()
if (!moving) { a = 1; anim = this._actionMap.turnRight; }
this would enable character to climb steps. Currently it stops if the slope max limit is less than 90.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.