How to create collision fit with my character?



this is my character with capsulecollisionshape..
how to make collision fit for my character?

i have read the tutorial java..that use ragdoll on the ogre character..
but when i use it , i have red line with walkdirection etc..
and try hull or otherthings and get

java.lang.UnsupportedOperationException: Kinematic character nodes cannot have mesh collision shapes

Use a hull collision shape.

i have use it but error java.lang.UnsupportedOperationException: Kinematic character nodes cannot have mesh collision shapes

i want to make it can hit other object like this







but it just punch through other object… :frowning:

Hull shapes work, what you want to do isn’t easy and requires a mix of different techniques as outlined in the ragdoll and character tests.

[java]

model = (Node) assetManager.loadModel(“Models/chibinew/chibi.mesh.xml”);

HullCollisionShape shape = new HullCollisionShape(model);

[/java]



but it said it’s not suitable constructor found for HullCollisionShape(com.jme3.scene.Node)

i use the



[java]CollisionShape modelShape = CollisionShapeFactory.createMeshShape(model);

RigidBodyControl rigidControl = new RigidBodyControl(modelShape, 0);[/java]



it follow the form of my character,

but the collision not move with the animation like punching…so still my punch have no collision…

Of course it won’t move… read what normen wrote. Your hull would need to change in every animation frame. This is computionally cumbersome and unnecessary. What you can do is to create a new sphere collision shape which moves with the position of the fist. And when you hit something, you can listen and process the collision event.

1 Like

thank you for giving me advice but what should i do/write i just newbie what i know is the capsule follow the root node of my character…

please give me some example for character that can hit something…

i really almost lost my hope with this stuff…

Well I don’t have the time to write everything down for you. What you want is not so easy but I give you the idea:



Look into the tutorials about Physics, Collision and Collision Listeners.

Create a sphere collision shape together with a Ghost Control and attach it to the fist somehow. This collision shape is your “punch”, this means that you only need to check if your fist a.k.a. this sphere collision touches another object. When the punch animation plays, you have to move the collision shape accordingly so that the sphere is always at the same position as your fist.

You then need a Collision Listener that gets fired when your fist a.k.a. your sphere touches another object. Then you can kill the other object, move it away etc.

1 Like

also you can set the shape initially to be the size of the model by using the extents of the boundingbox it is contained within

To create a hull from multiple geometries you can also batch them before. Or even smarter do that in the SDK and save only the resulting CharacterControl in the j3o.

what command to batch it?

to Dodikles thanks i 'll try it…

normen i have do many things but the best thing to fit it is do with







here normen i can hit it easily with

[java]ragdoll = new KinematicRagdollControl(0.5f);

model.addControl(ragdoll);[/java]



but it not compatible with charactercontrol variable like

[java]

setGravity(80f);

setJumpSpeed(40f);

jump();

setViewDirection(walkDirection);

setWalkDirection(walkDirection);

[/java]



so what should i do?

how to make KinematicRagdollControl collision to be a charactercontrol type?

or

make command like charactercontrol but use the kinematicragdollcontrol?



please some one give me some advice…

please help me someone…

please tell me how to get kinematicragdollcontrol collision to use in charactercontrol …

It doesn’t work! You will either have to use both at once and make them not collide by using different collision groups or you have to do the collision and movement part of the character yourself with physicsSpace.rayTest and .sweepTest

1 Like

yes i think it’s the best way use both collision make that both not collide each other with different collision group…

but now when i use both it collide each other until i fly arround because the ragdoll always push the capsule back…

so how to make it not collide each other but collide other object normen?

Read the javadoc of the setCollisionGroup and setCollideWithGroups methods, you are setting bit masks here!

I would add just another GhostObject (Character’s Mesh) for collision and did applyForce() to the objects to blow.