“debug shape” is the rest of the title, it got cut off.
First question: Often there are many times that objects I create in blender are quite complex, and I’d prefer to just be able to create a simple cube around them in Blender and use that as the collision model. My workflow is Blender → OBJ → JME. This works fine for simple meshes - it just uses the whole mesh as its collision mesh. But I want to make my own, simple collision meshes for models, and I want to draw them in Blender. How do I mark an object in Blender to indicate that I want JME to use it as the collision mesh?
Second question: I’ve set
and the collision shapes for scene objects that I’ve placed with the scene editor just fine. However, I can’t see the collision capsule that I’ve added around my player.
Things I’ve tried that do nothing:
- Calling “createDebugShape” on the CharacterControl object
- Looking for “attachDebugShape” which appeared to work in this thread here, but seems to not even exist as a function for me? Has it been removed? Anyway, the blue capsule in that picture is what I can’t get to show up.
Thanks in advance!
Your missing the
do your own thing,
for example create a node named physic, then in code write a method that loads your objects, searches for physic node detaches those from visible model, and creates the collision shape from it.
I guess I’ll implement my own solution for the collision meshes. Disappointing that JME doesn’t have a way built in, but no problem.
How about the second question - can someone provide working code displaying the debug mesh around their CharacterControl object so I can compare mine? I’m at my wit’s end as to why my code isn’t working.
Hi, ive not been abled to get the CharacterControll debug mesh working either, yet i have seen pictures. Like urself collison mesh on everything else works fine. Sorry thats no help, but you know your not the only one who it doesnt work for.
when do you call
I am just asking because I always call it after the BulletAppState is attached to the StateManager and I haven’t had an issue.
Usually I actually use a capsule that I created in blender using a sphere split and extruded. the measurements in Blender are the same in jMonkey and it looks better :D
If you use the Control like its used in the collision tutorial then its not attached to anything (and cannot render), the tutorial should use a CamNode really…
This is the relevant section of my code:
//Set up physics on the scene
bulletAppState = new BulletAppState();
CollisionShape sceneShape = CollisionShapeFactory.createMeshShape((Node) scene);
landscape = new RigidBodyControl(sceneShape, 0);
CapsuleCollisionShape playerShape = new CapsuleCollisionShape(1f, 4f, 1);
playerPhysics = new CharacterControl(playerShape, 0.05f);
//Add physics to objects
And this is the result: http://i.imgur.com/0Z6il.png
As you can see, the debug shows up around meshes (added in the SceneEditor) but not my CharacterControl object. ((I’ve tried it with and without the “createDebugShape” line, neither works.))
Physics works fine with the capsule though - I keep the player spatial in the same position as it by updating its translation in the simpleUpdate loop. Should I be doing something else instead?
@skidrunner - Awesome, that seems to have worked! Many thanks.