I’m trying to get a handle on jMonkey so I trying to modify the “Walking Character” tutorial to use a terrain instead of the quake3level. I didn’t have any issues doing this. The oto model lands on the terrain and I’m able to make he walk on it.
I then decide to convert the CharacterControl to a BetterCharacterControl. All of the functionality appears to be there but for some reason the model falls through the terrain up to his waist. I’m figuring that there is some sort of offset I need to set on the BetterCharacterControl but I haven’t been able to find it. I have tried several different things that haven’t seemed to affect this issue.
Here is the code that is working:
[java]CapsuleCollisionShape capsule = new CapsuleCollisionShape(3f, 4f);
character = new CharacterControl(capsule, 0.05f);[/java]
Here is what I’m replacing it with:
[java]character = new BetterCharacterControl(0, 0, 1f);[/java]
After a little more testing this line only has him dropping through to about knee high.
[java]character = new BetterCharacterControl(0, -10, 0);[/java]
you should maybe enable the collision to see where the character is actually (not where the oto is - there may be an offset here).
even if the charactercontrol is deprecated and the bettercharactercontrol is suppose to be … well, “better”, i still advice you to use the charactercontrol, except if you need to change the gravity of your character.
The bettercharactercontrol has some bugs and even if i tried to solve some of them, i just throw in the towel right now. To summerize, the bettercharactercontrol doesn’t have the “stepheight” stuff, meaning that it will just block on any stairs (instead of climbing them), will “fly” when going down a too harsh slop and will, in general, “jump” by itself everywhere.
I didn’t blame anything for that, a charactercontrol is something very hard to do, as it’s not only a translation of some physic stuff into a language. No, it’s a lot more than this, it’s the translation of a human “standard” behavior in a lot of situation a bit tricky.
When i loaded the ninja in my precedent game, it appears to be VERY tall - like 100 times too tall. Maybe this happens to oto.
if you don’t really find from where comes the bug, if the collision stuff is ok and only the appearance is not correct, you could do something like that:
[java]
//“node” is a Node, and is the node where you attached oto
//“offset” is an int and contains the offset of oto with the bettercharactercontrol
Node movedNode = new Node(“appearance”);
movedNode.setLocalTranslation(0, offset, 0);
node.attachChild(movedNode);
[/java]
This is not a “good” solution however. I will try to find the source of the bug tomorrow.
Thanks for the info. I was mainly trying to use it because of the depreciation. I think for now, considering I’m still learning the basics of jMonkey, I will just switch back to CharacterControl.
Hallo scuse me for intrusion,“bubuche” maybe you can help me I have a similar problem that is in a my precedent test I 'have problem with collision of two characters and I’ve raccomendated to use BetterCharacterControl rightly becouse two Characters can’t collide, but I don’t be able to use it corretlly. This is the old post :
My objective is the collision of two player , if you have different idea,test or other for realize it I 'm very happy to listen you:)
Thanks in advance.
@bubuche and I found that BetterCharacterControl, when added to physics space, does not go to the characters list there! also I am experiencing all other reported problems too, I will try the old charactercontrol then… thx! I think the best way it to keep trying the BetterCharacterControl tho and provide my own fixes to it to fit my needs.
The internal lists are not supposed to be used for your purposes anyway, it seems you fell into the trap of trying to make a library do what you want your application to do. Just keep your own lists of things.