Rotation for Motorbike Handle

Thank you for your help irrisor.



I found out that my problem of steering was just the relation between desiredVelocity and available speed.

Now I have configured two parameters for a nice steering behaviour:

A very low desiredVelocity and

a very high available speed.



Of course, I used what you suggested: a powered rotational joint axis (y-rotational axis on first joint and z-rotational axis on second joint for the wheel itself) with a high available speed for the y-axis (500).



The elastic joint thing was increased by unrealistic high mass of the wheels which were set manually to 500.

Therefore I deleted these assigments, generatedPhysicsGeometry, set a material and computed mass.

Now its fine also.

_________________________________



But there is a new problem:

The rear wheel collides heavily with the rocker of the motorbike (the model is again at my 2 wheel motorbike with the challenge of balancing^^)



How can I prevent collision of them?

The rocker (with the chain) is just a dpn wihout physics geometry or anything.

The wheelRear is a dpn with mass, geom, material,…



I tried to use the collisoncallback:

 private void createContactCallbacks( PhysicsSpace space ) {
        space.getContactCallbacks().add( new CollisionAvoider( chassis, wheelRear ) );
        space.getContactCallbacks().add( new CollisionAvoider( chassis, wheelFront ) );
        space.getContactCallbacks().add( new CollisionAvoider( chassis, handle ) );
        space.getContactCallbacks().add( new CollisionAvoider( chassis, rocker ) );
        space.getContactCallbacks().add( new CollisionAvoider( rocker, wheelRear ) );
    }



and the internal class:


private class CollisionAvoider implements ContactCallback
    {

        DynamicPhysicsNode node1, node2;

        public CollisionAvoider( DynamicPhysicsNode node1, DynamicPhysicsNode node2 )
        {
            super();
            this.node1 = node1;
            this.node2 = node2;
        }

        public boolean adjustContact( PendingContact contact )
        {
            boolean isNode2 = contact.getNode1() == node2 || contact.getNode2() == node2;
            boolean isNode1 = contact.getNode1() == node1 || contact.getNode2() == node1;
         if (isNode2 && isNode1){
            contact.setIgnored(true);
            return true;
         }
         return false;
      }   
   }

The contact between wheelRear and the rocker and also between wheelFront and handle is still a problem.



I would appreciate any further help.



Hi,

Thanks!



I have problems using the CollisionGroup because it's new to me and the class is abstract. Therfore I implemented my own class extending CollisionGroup. But I don't know what to do and how to do, anyway it's new for me  :lol:



That's what I've done untill yet:

public class BikeCollisionGroup extends CollisionGroup
{
   public BikeCollisionGroup( PhysicsSpace space, String name )
   {
      super(space,name);
    }

   @Override
   protected void nodeAdded(PhysicsNode node)
   {
      // TODO
   }

   @Override
   protected void nodeRemoved(PhysicsNode node)
   {
      // TODO
   }
}



Can you give me a hint how to realize my purpose? 
What can the methods nodeAdded() and nodeRemoved() do.. or what I'm supposed to implement there?
Unfortunately there are no hints in the API or in the jmephysics wiki.

Put the the whole bike into a collision group and configure it without collision checks with the group itself.


How can the checks within a group be configured? What are the other important steps after adding each dpn to the CollistionGroup? I'm not understanding the concept yet ://
mathias4u said:

Therfore I implemented my own class extending CollisionGroup.

Uh, that does not make sense, sorry. There are no demos for the collision groups yet - maybe I should not have proposed them. You can achieve similar things by ignoring contacts between the bikes geoms in a collision callback (see TestContactCallback).
I'll cobble together a test, stay tuned...

Ok, test is in SVN: TestCollisionGroups



Search for "collisionGroup" in there to find the relevant code parts.

Great, thanks!



I will have a look at the test in the evening (after work) at about 8 pm Germany time.



SVN, should be no problem. I'm currently using jME 1 and jMEPhysics2 from the CVS. I do believe to have read some thread which said that it's correct and furthermore jMEPhysics 2 from the SVN fits to jME2 (also SVN).



I guess there is no need to change to physics from the SVN yet that's not to say that I won't do that. Neverthelsess I want to stay with jME 1.



Might there occur any problems using physics from the SVN and staying with jME 1? I may have to reconsider what I've read about it.

jME Physics SVN works with jME SVN only. But you can grab the test source from the web:

http://jmephysics.googlecode.com/svn/trunk/test-interactive/com/jmetest/physics/TestCollisionGroups.java



The important snippets should work with jME Physics CVS / jME 1.0. Only those two lines with getDefaultCollisionGroup() and getStaticCollisionGroup() won't work - replace those calls with createDynamicNode().getCollisionGroup() and createStaticNode().getCollisionGroup().

Thanks again,



the collisionGroup was quite easy to set up and it worked immediately.

Now my bike is ready to ride :smiley:



Next step will be to balance it: Therefore I thought to define three points relative to the bike: left, up and right. If a player doesn't steer then the up position is balanced by adding forces to the chassis to reach and hold the up position. If he or she steers left then the left position is active and the forces should do the leening.



I thought to set the left and right position in a radios defined by the height "up" position.



Do you think this could work ?

Hmm, why not :slight_smile: - it's probably easier than putting an actual "driver" (dpn with mass) on the bike :wink:

Hi,



my bike is implemented with “balancing” included :stuck_out_tongue:



I tried out at leat 9 ways to balance the motorbike. All worked, but most of them have been too unreal or have to much influence on the behavoir as well as pendulum effects. No the effects were not intended :lol:



The bike has now 2 helping wheels on each side which looks real funny in the debug mode. But it works!

Sure the bike has not a perfect behaviourr within every terrain but I’m finished ATM. I focus now at the rest of our project.



Up standing:





Left-leaning:

Cool that you got it working. Looks fine :slight_smile:

Thank you irrisor for your help and your patience :slight_smile: