Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Mar 28, 2024 11:10 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Jul 20, 2009 1:06 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
I've done this function for my own use. It works for me but I'm not sure if it's working 100% as expected for other people. (I'm using ".group" but really I don't know what it is)
It allows to move an object(not just an element) for a certain distance(x,y,z) from its previous position.

Code:
void raydium_ode_object_move_relative_3f( int obj, float x, float y, float z)
{
dReal *refp;
dReal pos[3];
refp=(dReal *)dGeomGetPosition(dSpaceGetGeom(raydium_ode_object[obj].group,0));
pos[0]=refp[0]+x;
pos[1]=refp[1]+y;
pos[2]=refp[2]+z;
raydium_ode_object_move(obj, pos);
}

void raydium_ode_object_move_name_relative_3f( char *name, float x, float y, float z)
{
raydium_ode_object_move_relative_3f(raydium_ode_object_find(name),x,y,z);
}


It's ok? Should I commit this?


Top
 Profile  
 
PostPosted: Mon Jul 20, 2009 2:28 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
IMHO, no ... This function will move all elements of an object with an offset relative to current position of the "last" element of the object :
dGeomGetPosition(dSpaceGetGeom(raydium_ode_object[obj].group,0)) will return coords of this element (id=0 means, weirdly, "last element" for an ODE space)

I think the correct (generic ?) way to implement this function would be to get position of every element of the object, and apply the provided offset individually. This could be done easily with a slightly modified version of raydium_ode_object_move() ... but it would require a bit of refactoring, since it's not very cool to duplicate a big bunch of code in the core :)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 33 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:  
cron
Powered by phpBB® Forum Software © phpBB Group