Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Sun Apr 28, 2024 3:13 pm

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: how to block a wheel?
PostPosted: Fri Jun 09, 2006 11:56 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
I'm trying to block a wheel like if you press the brake pedal. But all i got is to blcok the direction.
I'm using maniadrive to the tests.
The current code is:
Code:
if(raydium_key_last==1048)   
{
dReal cero[]={0,0,0};
raydium_ode_joint_hinge2_block_name("suspet_ag",1);
raydium_ode_joint_hinge2_block_name("suspet_ad",1);
raydium_ode_joint_hinge2_block_name("suspet_rg",1);
raydium_ode_joint_hinge2_block_name("suspet_rd",1);
raydium_ode_element_addtorque_name("pneu_ag",cero);
raydium_ode_element_addtorque_name("pneu_ad",cero);
raydium_ode_element_addtorque_name("pneu_rg",cero);
raydium_ode_element_addtorque_name("pneu_rd",cero);
}

Ideas to block the wheels?


Last edited by vicentecarro on Thu Jun 15, 2006 6:13 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 11:57 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
raydium_ode_joint_hinge2_block() is used to align an hinge2 along car axis (so that rear wheels don't turn on Z axis).

raydium_ode_element_addtorque() adds torque force, so you should counter the current torque with a negative torque, or something like that (and it's not easy).

The best idea is to play with motors : set a 0 speed and a big value for motor's power. with ManiaDrive, search for the line :
Code:
if(raydium_joy_y<0.3)

and change de block with this, for example:
Code:
speed=0;
raydium_ode_motor_power_max_name("moteur",1);


With "1", the wheels blocks almost instantly.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 6:52 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
it doesn't work for me, but even if it work, i think that is not the effect that i want to get.
I like to brake certain wheels to get a drift controlled or uncontrolled, according the pressed keys, de inertia, the velocity, the terrain...
And the only way to achieve that is, i think, to block the wheels....

I'm thinking now... it's possible to apply a certain( high) friction in the join wheel-chasis? in that way, the effect is really like if the wheel was braked.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 7:12 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
i'm trying with angular motors fo the wheels, but it's hard to "see"


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 9:14 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
phiuuuuu...
a few hours to get it, but finally i success.
I have disable the main motor, and i have applied torques to the wheels, and so the brake works right.
Now i have a real world problem, i need an ABS system :D if i block the wheels with too much velocity, they almost no brake the car.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 10:07 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
sorry, i'm back
the system has a problem, the torque is universal, not local. So when i'm turning left, the "forward"means to my right, and the car dump to the right :oops:
Well, i think that i need new ideas or help at this point...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 11:28 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
You should not use addtorque ... :) It's only a way to "force" physics, and it's quiet bad.
I don't understand why "engine motors" does not work for you. You can do all you want with this method, and even ABS is possible, tuning the power_max value. It's exactly the way a real brake works ;)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 8:11 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Imagine this scene:
The wheels of the cars start rolling at too much speed. Cause of this the car drift to the left(or right) but the car won't advance because the pilot is braking(the frontal wheels).
This scene is "normal" in films but i think that using usual engine motors i can not get it. I'm wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 8:21 pm 
Offline

Joined: Fri Mar 17, 2006 12:41 pm
Posts: 46
Location: Gif/Yvette, France
It looks like a burn-out, but it is usually done with a bike where there are 2 brakes (front and rear). With a car maybe you can use 2 or 4 motors (1 by wheel) and apply a distinct braking/acceleration to each one (I don't know if it's possible with raydium, though).

By the way, I didn't test either but I suppose if you apply suddendly a huge torque to the wheels, they will start to drift [déraper] on the ground, won't they ?

_________________
Phyce


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 8:26 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
yes, they drift well, the (last) problem was aligning the torque vector with the car direction. Could be fine a local relative torque function.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 8:33 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
In this scene, are you talking about rear wheels or front wheels ? :)

For front wheels (where the brakes are), the method with "0 speed engine" is perfect. For a good simulation of rear wheels ... see Pacejka :)

http://www.racer.nl/reference/pacejka.htm

A few times ago, I was thinking about integrating a very simplified Pecejka model into Raydium, but never found the time for it :) (The base idea is simply to change dynamically ERP/CFM of wheels)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 8:43 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
wow, that looks complex.
In the scene, the rear wheels are the ones that drift the car, and the frontal wheels block the car since, they are braked.
I have get similar effects but using the previously commented torque functions. Maybe i'll finish making a hack to the ode functions :D


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 8:56 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
If torque works for you, I can add a RayODE wrapper for the ODE function "dBodyVectorToWorld()". This function "translates" a local vector (relative to a body) to a world vector, so it will probably solve you last problem. Or I'm missing something ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 11, 2006 9:16 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
thanks, really is not a must, so we can leave it.
For the "other game" (you know) i'm trying with standard engine :)
Anyway, i think that function that you said could be interesting in a future, for example for biped animations.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 218 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group