controlling game/physics entity orientation

View: New views
5 Messages — Rating Filter:   Alert me  

controlling game/physics entity orientation

by je.a.le :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,

I trying to control the direction - angle of the two fronts wheels - of a test
"car", which is actually a box + 4 cylinders linked with hinge2 joint (ode
sphereshape).

Physics and input work fine. What I'm doing :

add physics property to game::entity
add my property - whom I control and set the "wheel" angle
add graphics property
add transformable property

To move/propulse the "car" I would go with ode forces (correct??), but here I
thought I have to directly work/update  the rigidbodies transformable matrix,
just before physics simulation happen, so :
in myproperty::OnMoveBefore()

..........
// get rigidbody one way or other
Physics::RigidBody* body = (Physics::RigidBody*)joint->GetBody2();

        matrix44 m;
        m.ident();
        // the absolute angle of the wheel direction player want
        m.rotate_y( n_deg2rad( this->getDirection() ) );

        matrix44 mt = m * body->GetInitialTransform();
        matrix44 mt2 = mt * phyentity->GetTransform(); // physics::entity
        body->SetTransform( mt2 ); // update the matrix and ode too
............

what happen : the wheels rotate correctly according to requested angle, but
there's a visual blinking, It's like the (graphics??) entity keep changing from
user to initial position/orientation.


What I'm doing wrong or forget ?????

THKS

--
for my 3d work it's over there --> http://j.a.l.free.fr/3dsmax
update 26 Aug 2006

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: controlling game/physics entity orientation

by Ghoust :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

what i know is that you normally would apply a force vector to propulse
your bodies and not set the transform.
It should be the same was as described in the ode documentation.

Tom

je.a.le wrote:

> hi,
>
> I trying to control the direction - angle of the two fronts wheels - of a test
> "car", which is actually a box + 4 cylinders linked with hinge2 joint (ode
> sphereshape).
>
> Physics and input work fine. What I'm doing :
>
> add physics property to game::entity
> add my property - whom I control and set the "wheel" angle
> add graphics property
> add transformable property
>
> To move/propulse the "car" I would go with ode forces (correct??), but here I
> thought I have to directly work/update  the rigidbodies transformable matrix,
> just before physics simulation happen, so :
> in myproperty::OnMoveBefore()
>
> ..........
> // get rigidbody one way or other
> Physics::RigidBody* body = (Physics::RigidBody*)joint->GetBody2();
>
> matrix44 m;
> m.ident();
> // the absolute angle of the wheel direction player want
> m.rotate_y( n_deg2rad( this->getDirection() ) );
>
> matrix44 mt = m * body->GetInitialTransform();
> matrix44 mt2 = mt * phyentity->GetTransform(); // physics::entity
> body->SetTransform( mt2 ); // update the matrix and ode too
> ............
>
> what happen : the wheels rotate correctly according to requested angle, but
> there's a visual blinking, It's like the (graphics??) entity keep changing from
> user to initial position/orientation.
>
>
> What I'm doing wrong or forget ?????
>
> THKS
>
>  


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: controlling game/physics entity orientation

by je.a.le :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ghoust wrote:
> what i know is that you normally would apply a force vector to propulse
> your bodies and not set the transform.
> It should be the same was as described in the ode documentation.
>
> Tom
>
Thks, I were looking for something more direct but it doesn't seem to be !

reminder : I try the classic car test : a shapebox + 4 spheres for wheels + 4
hinge2. ground (hill) is a meshshape. size : 1 unit = 1 meter

So i try some solutions and I get some results but :

1) for steering I set directly velocity (dParamVel) on both front hinge2 as read
on all samples I found. Work but with huge friction front wheels rapidly aren't
parallel anymore. What -cheap- solution for a kind of steering bar ?? (meaning
when a force push on one wheel, push the other too...)

2) for the car to move, I have to "power" the four wheel. By only setting
velocity of front wheel, rear are like welded

What's wrong with all of that ??? I'm really out of ideas !!


optional questions !
1)powering front wheels with the same force/vel only work when moving forward,
when turning, what would be your solution beside scaling according to wheel angle ?
2) ode doc talk about setting suspension with hinge2 suspensionERP/CFM any
examples out here ??? I don't really get a "springing" effect !


Thks

--
for my 3d work it's over there --> http://j.a.l.free.fr/3dsmax
update 26 Aug 2006


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: controlling game/physics entity orientation

by James Mastro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

je.a.le wrote:
> 1)powering front wheels with the same force/vel only work when moving forward,
> when turning, what would be your solution beside scaling according to wheel angle ?
> 2) ode doc talk about setting suspension with hinge2 suspensionERP/CFM any
> examples out here ??? I don't really get a "springing" effect !

Have you looked into the 'buggy' demo that comes with ODE? I made a car
demo (not using N2) using that as a base, and I had decent suspension
working.

-jim


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: controlling game/physics entity orientation

by je.a.le :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

James Mastro wrote:

> je.a.le wrote:
>> 1)powering front wheels with the same force/vel only work when moving forward,
>> when turning, what would be your solution beside scaling according to wheel angle ?
>> 2) ode doc talk about setting suspension with hinge2 suspensionERP/CFM any
>> examples out here ??? I don't really get a "springing" effect !
>
> Have you looked into the 'buggy' demo that comes with ODE? I made a car
> demo (not using N2) using that as a base, and I had decent suspension
> working.
>
> -jim
>
>

Yes just did this morning. Same code as I already found but when looking at
ode's amotor doc :

"Motors can also be used to accurately model dry (or Coulomb) friction in
joints. Simply set the desired velocity to zero and set the maximum force to
some constant value"

I misunderstood fmax function ; basically I were trying to drive a car with
parking brake on !
This solve the "welded rear wheels pb" and with some adjusting  get a quite
interesting simulation too :-). For the rest nothing new.

Thks

--
for my 3d work it's over there --> http://j.a.l.free.fr/3dsmax
update 26 Aug 2006


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss