Query on HelloPhyics tutorial?

Hi All,



I was going through physics tutorial for beginners.



I wanted to learn how to make the cross hair and how to associate shoot operation to the aim.



I have made the corss hair but its not visible.

Secondly in the makeCannonBall operation I can’t understand how does the shooting is aimed at cross hair.



Please help.



Manish

Crosshair visibility issue is solved.

Second query still holds good.



Manish

The shooting is done by this line:

[java]ball_phy.setLinearVelocity(cam.getDirection().mult(25));[/java]

It applies a velocity to the ball into the current camera looking direction. If you need to refresh your vector math knowledge, take a look at jME3 Math for Dummies (it’s sometimes not available for some reason).

Hi…shootinh I am able to achieve.

My issue is that when my launched body reaches target body it just pass thru it, without showing any collison impact.

I have added RigidBodyControl to concerned geometries and then added it to BulletAppState.Something like this:



striker_phy = new RigidBodyControl(0.1f);

striker.addControl(striker_phy);

if(striker.getControl(RigidBodyControl.class)!=null){

((RigidBodyControl)striker.getControl(RigidBodyControl.class)).setKinematic(true);

}

bulletAppState.getPhysicsSpace().add(striker_phy);



What I expect by this is that collision is detected, friction influence is taken into account and impact of collisionis shwon, just like physics tutorial does.

But nothing is happening for me.Body just passes thru the target.



coin_phy = new RigidBodyControl(0.1f);

coin.addControl(coin_phy);

if(coin.getControl(RigidBodyControl.class)!=null){

((RigidBodyControl)coin.getControl(RigidBodyControl.class)).setKinematic(true);

((RigidBodyControl)coin.getControl(RigidBodyControl.class)).setFriction(.1f);

}

bulletAppState.getPhysicsSpace().add(coin_phy);



Manish

Kinematic physics objects are a bit tricky because they are animated by you and not by the physics engine. If you move them too much in one physics tick (fast object), the collision is not detected. You can try to increase the accuracy as shown here.



Please note that since kinematic objects are not animated by the physics engine, they will not “collide” with each other in the sense of “one is bouncing away the other”. One of them has to be non-kinematic (dynamic, with mass > 0) to achieve this. In the case of NabyBallMaze, the floor and the labyrinth are kinematic and the ball is dynamic. Floor and labyrinth collide (touching each other), but they are not bouncing each other away nor is the ball bouncing them. The ball is bounced by them, of course.



http://www.youtube.com/watch?v=OmiY6_CZjrU

You probably create mesh shapes for both objects which is wrong.

i m using constructor provided injme…and yes as they both ask for triangles, so it means they r meshed.



so how does both being meshed impacts collision physics?

and how can i make one of them non-meshed?

…contd



as cylinder in jme has all constructors asking for traingles as arg…

Do the tutorials, its all explained.