Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Dec 05, 2019 5:15 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Object position
PostPosted: Wed Jul 02, 2008 10:50 pm 
Offline
User avatar

Joined: Thu Aug 24, 2006 4:06 pm
Posts: 73
Location: SLOVAKIA
Howto get world position of created object?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 10:25 am 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

Object are "space" that handle several element. Each element have his own position within the space/object. This usefull to speed up collision detections.

It's better to get element pos of an revelant element of your object.

I can't add raydium_ode_object_pos_get, because i can't chose which element position i have to report.

Is it clear ? I hope so ...

Have a nice day.

Ouille


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 3:51 pm 
Offline
User avatar

Joined: Thu Aug 24, 2006 4:06 pm
Posts: 73
Location: SLOVAKIA
OK. I understand.

But then question is, why when is created object with this:

int a=raydium_ode_object_create("OBJNAME");

is problem call:

dReal *pos;
pos = raydium_ode_object_get_pos_name("OBJNAME");

or

raydium_ode_object_get_pos_(a);


Note: I need place car back to normal position on current space position after flipping or crash, etc. All returned position are local offset :(

thx


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 5:33 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,

It's not as simple ...

Your car contains joints. So if you want to put your car at an other position / orientation. You will compute all joint relative orientation and put objects at the same place. It's quite complicated.

An other solution is to destroy object and built it at the new position. This can be done in one frame and work very well (have a look at mania drive for example).

It's the solution to this kind of problem (almost i think it is).

have a nice day
Ouille.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 6:05 pm 
Offline
User avatar

Joined: Thu Aug 24, 2006 4:06 pm
Posts: 73
Location: SLOVAKIA
ouille wrote:
Hello,

...

An other solution is to destroy object and built it at the new position. This can be done in one frame and work very well (have a look at mania drive for example).

....



I don't agree. When car crash in middle of LAP, i need know THIS position for continue or flip car .

Sorry rayidium must be usefuly without limitation.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 7:25 pm 
Offline

Joined: Sun Oct 09, 2005 10:46 pm
Posts: 759
Hello,


When car crash.
1) Get car position (body element of the car).
2) Destroy the car.
3) Create a new car and move it to the postion (with correction) obtained in 1.


On the other side: to get object position you want:
Body car postion ? front left wheel postion ? rear right wheel position ? All of this are in the same object.

It is not a raydium limitation. Object are container for broad phase collision detection, and that's all.

Hope this help.

here is a function based on your own:

Code:
void RKR_FlipCar(int ID)
{
    dReal *pos;
    dReal spos[3];

    pos = raydium_ode_element_pos_get_name("corps"); //?????
    memcpy(spos,pos,sizeof(dReal)*3);
    RKR_CreateCarFromDefinition(ID);
    raydium_ode_object_move_name_3f (CarDefinitionList[ID].chassis.name, spos[0], spos[1], 2);

}


Press "end" key very briefly to test function (in other case car will fly away, for the reason already exposed).

Nice reflection on the car !


Have a nice day
Ouille.


Last edited by ouille on Thu Jul 03, 2008 7:28 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 7:26 pm 
Offline
User avatar

Joined: Thu Aug 24, 2006 4:06 pm
Posts: 73
Location: SLOVAKIA
thx


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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:  
cron
Powered by phpBB® Forum Software © phpBB Group